{"description":"Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible.String s consists only of lowercase Latin letters, and it is allowed to change characters only to lowercase Latin letters too.","input_specification":"First line of input contains string s, consisting only of lowercase Latin letters (1\u2009\u2264\u2009|s|\u2009\u2264\u20091000, |s| denotes the length of s). Second line of input contains integer k (1\u2009\u2264\u2009k\u2009\u2264\u200926).","output_specification":"Print single line with a minimum number of necessary changes, or the word \u00abimpossible\u00bb (without quotes) if it is impossible.","notes":"NoteIn the first test case string contains 6 different letters, so we don't need to change anything.In the second test case string contains 4 different letters: {'a',\u2009'h',\u2009'o',\u2009'y'}. To get 5 different letters it is necessary to change one occurrence of 'o' to some letter, which doesn't occur in the string, for example, {'b'}.In the third test case, it is impossible to make 7 different letters because the length of the string is 6.","sample_inputs":["yandex\n6","yahoo\n5","google\n7"],"sample_outputs":["0","1","impossible"],"src_uid":"bd5912fe2c5c37658f28f6b159b39645","lang_cluster":"C++","difficulty":1000,"human_solution":"#include\nusing namespace std;\n\nint main()\n{\n\t\/\/char str[1000];\n\tint k,count;\n string str;\n\tcin>>str;\n\t cin>>k;\n\n int value=str.length();\n\t\n\t\n int cnt=0;\n\tfor(int i=97;i<123;i++)\n\t{ count=0;\n\t\tfor(int j=0;j0)\n \tcnt++;\n\t}\n if(k>value)\n\t{\n\t\tcout<<\"impossible\";\n\t}\n else if(k<=cnt)\n {\n cout<<\"0\";\n }\n\telse\n\t{ k=k-cnt;\n\t\t cout<\nusing namespace std;\nconst int mod = 1000000007;\n#define mem(m,v) memset(m,v,sizeof(m))\n#define pb push_back\n#define mp make_pair\n#define si(n) scanf(\"%d\",&n)\n#define all(x) (x.begin() , x.end() )\n#define sz(x) x.size();\ntemplate inline void checkmax(t &a,t &b)\n{if(b>a)a = b;}\ntemplate inline void checkmin(t &a,t &b)\n{if(b vi;\ntypedef vector vs;\ntypedef vector > vvi;\ntypedef pair pii;\ntypedef double ld;\ntypedef vector vpii;\nstring s[1005];\nint a[1005];\nmap m;\nmap :: iterator it;\nint main()\n{\n int n;\n cin>>n;\n for(int i=0;i>s[i]>>a[i];\n int curr=0;\n int ans = 0;\n \n for(int i=0;i\r\nusing namespace std;\r\nint main(){\r\n int x1,y1;\r\n cin>>x1>>y1;\r\n int x2,y2;\r\n cin>>x2>>y2;\r\n int a=abs(x2-x1);\r\n int b=abs(y2-y1);\r\n if(a>=b){\r\n cout<\nusing namespace std;\nconst int MAXN = 110;\nint mtr[MAXN][MAXN];\nint main() {\n int N, A, B;\n cin >> N >> A >> B;\n int disp = A * B - N;\n if (disp < 0) {\n cout << \"-1\\n\";\n return 0;\n }\n int x_ = 1, y_ = 1, imp = 1, p = 2, cnt = 1;\n int NN = N;\n while (N) {\n \/\/ cout << \"imp \" << y_ << \" \" << x_ << \" \" << mtr[y_ - 1][x_] << '\\n'; \n if (mtr[y_ - 1][x_] == 0) {\n mtr[y_][x_] = min(imp, p);\n if (imp < p) imp += 2;\n else p += 2;\n N--;\n } else if (mtr[y_ - 1][x_] % 2) {\n if (p <= NN) { \n mtr[y_][x_] = p;\n p += 2;\n N--;\n } else mtr[y_][x_] = 0;\n } else {\n if (imp <= NN) { \n mtr[y_][x_] = imp;\n imp += 2;\n N--;\n } else mtr[y_][x_] = 0;\n }\n x_++;\n x_ %= (B + 1);\n if (!x_) x_ = 1;\n if (x_ == 1) y_++;\n }\n int mats = 0;\n for (int i = 1; i <= A; ++i) \n for (int j = 1; j <= B; ++j) mats = max(mats, mtr[i][j]);\n if (NN != mats) {\n cout << \"-1\\n\";\n return 0;\n }\n for (int i = 1; i <= A; ++i) {\n for (int j = 1; j <= B; ++j) cout << mtr[i][j] << \" \";\n cout << '\\n';\n }\n return 0;\n}","testcases":"[{'input': '3 2 2\\r\\n', 'output': ['1 2 \\r\\n0 3 \\r\\n']}, {'input': '8 4 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 0 \\r\\n0 0 0 \\r\\n']}, {'input': '10 2 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1\\r\\n', 'output': ['1 \\r\\n']}, {'input': '8 3 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 0 \\r\\n']}, {'input': '1 1 100\\r\\n', 'output': ['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 \\r\\n']}, {'input': '1 100 1\\r\\n', 'output': ['1 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n']}, {'input': '12 4 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 9 \\r\\n10 11 12 \\r\\n']}, {'input': '64 8 9\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 \\r\\n10 11 12 13 14 15 16 17 18 \\r\\n19 20 21 22 23 24 25 26 27 \\r\\n28 29 30 31 32 33 34 35 36 \\r\\n37 38 39 40 41 42 43 44 45 \\r\\n46 47 48 49 50 51 52 53 54 \\r\\n55 56 57 58 59 60 61 62 63 \\r\\n64 0 0 0 0 0 0 0 0 \\r\\n']}, {'input': '13 2 6\\r\\n', 'output': ['-1\\r\\n']}, {'input': '41 6 7\\r\\n', 'output': ['1 2 3 4 5 6 7 \\r\\n8 9 10 11 12 13 14 \\r\\n15 16 17 18 19 20 21 \\r\\n22 23 24 25 26 27 28 \\r\\n29 30 31 32 33 34 35 \\r\\n36 37 38 39 40 41 0 \\r\\n']}, {'input': '10000 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '26 1 33\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 0 0 0 0 0 0 0 \\r\\n']}, {'input': '3 1 6\\r\\n', 'output': ['1 2 3 0 0 0 \\r\\n']}, {'input': '109 37 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 9 \\r\\n10 11 12 \\r\\n13 14 15 \\r\\n16 17 18 \\r\\n19 20 21 \\r\\n22 23 24 \\r\\n25 26 27 \\r\\n28 29 30 \\r\\n31 32 33 \\r\\n34 35 36 \\r\\n37 38 39 \\r\\n40 41 42 \\r\\n43 44 45 \\r\\n46 47 48 \\r\\n49 50 51 \\r\\n52 53 54 \\r\\n55 56 57 \\r\\n58 59 60 \\r\\n61 62 63 \\r\\n64 65 66 \\r\\n67 68 69 \\r\\n70 71 72 \\r\\n73 74 75 \\r\\n76 77 78 \\r\\n79 80 81 \\r\\n82 83 84 \\r\\n85 86 87 \\r\\n88 89 90 \\r\\n91 92 93 \\r\\n94 95 96 \\r\\n97 98 99 \\r\\n100 101 102 \\r\\n103 104 105 \\r\\n106 107 108 \\r\\n109 0 0 \\r\\n']}, {'input': '15 2 8\\r\\n', 'output': ['1 2 3 4 5 6 7 8 \\r\\n10 9 12 11 14 13 0 15 \\r\\n']}, {'input': '29 3 11\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 10 11 \\r\\n12 13 14 15 16 17 18 19 20 21 22 \\r\\n23 24 25 26 27 28 29 0 0 0 0 \\r\\n']}, {'input': '16 18 1\\r\\n', 'output': ['1 \\r\\n2 \\r\\n3 \\r\\n4 \\r\\n5 \\r\\n6 \\r\\n7 \\r\\n8 \\r\\n9 \\r\\n10 \\r\\n11 \\r\\n12 \\r\\n13 \\r\\n14 \\r\\n15 \\r\\n16 \\r\\n0 \\r\\n0 \\r\\n']}, {'input': '46 3 16\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \\r\\n18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 \\r\\n33 34 35 36 37 38 39 40 41 42 43 44 45 46 0 0 \\r\\n']}, {'input': '4206 86 12\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2358 14 56\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5420 35 96\\r\\n', 'output': ['-1\\r\\n']}, {'input': '7758 63 41\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9806 87 93\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99 1 97\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1053 25 42\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4217 49 86\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2312 77 30\\r\\n', 'output': ['-1\\r\\n']}, {'input': '74 1 71\\r\\n', 'output': ['-1\\r\\n']}]","id":4} {"description":"Pasha has two hamsters: Arthur and Alexander. Pasha put n apples in front of them. Pasha knows which apples Arthur likes. Similarly, Pasha knows which apples Alexander likes. Pasha doesn't want any conflict between the hamsters (as they may like the same apple), so he decided to distribute the apples between the hamsters on his own. He is going to give some apples to Arthur and some apples to Alexander. It doesn't matter how many apples each hamster gets but it is important that each hamster gets only the apples he likes. It is possible that somebody doesn't get any apples.Help Pasha distribute all the apples between the hamsters. Note that Pasha wants to distribute all the apples, not just some of them.","input_specification":"The first line contains integers n, a, b (1\u2009\u2264\u2009n\u2009\u2264\u2009100;\u00a01\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n) \u2014 the number of apples Pasha has, the number of apples Arthur likes and the number of apples Alexander likes, correspondingly. The next line contains a distinct integers \u2014 the numbers of the apples Arthur likes. The next line contains b distinct integers \u2014 the numbers of the apples Alexander likes. Assume that the apples are numbered from 1 to n. The input is such that the answer exists.","output_specification":"Print n characters, each of them equals either 1 or 2. If the i-h character equals 1, then the i-th apple should be given to Arthur, otherwise it should be given to Alexander. If there are multiple correct answers, you are allowed to print any of them.","notes":null,"sample_inputs":["4 2 3\n1 2\n2 3 4","5 5 2\n3 4 1 2 5\n2 3"],"sample_outputs":["1 1 2 2","1 1 1 1 1"],"src_uid":"a35a27754c9c095c6f1b2d4adccbfe93","lang_cluster":"C++","difficulty":800,"human_solution":"#include \r\n \r\nusing namespace std;\r\n#define ull unsigned long long \r\n \r\n\r\nint main()\r\n{\r\n int n,a,b;\r\n cin>>n>>a>>b;\r\n vector va(a),vb(b);\r\n for(int i=0;i>va[i];\r\n for(int i=0;i>vb[i];\r\n sort(va.begin(),va.end());\r\n sort(vb.begin(),vb.end());\r\n vector ans(n+1,-1);\r\n for(int i=0;i\n#include \nusing namespace std;\n\nint main(void)\n{\n int n, a;\n cin >> n;\n vector v(n, false);\n for (int i = 0; i != n; ++i)\n {\n cin >> a;\n if (a <= n)\n v[a-1] = true;\n }\n a = 0;\n for (int i = 0; i != n; ++i)\n a += v[i];\n cout << v.size() - a;\n return 0;\n}\n","testcases":"[{'input': '3\\r\\n3 1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n5 3 3 3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n6 6 6 6 6\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n1 1 2 2 8 8 7 7 9 9\\r\\n', 'output': ['5\\r\\n']}, {'input': '8\\r\\n9 8 7 6 5 4 3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '15\\r\\n1 2 3 4 5 5 4 3 2 1 1 2 3 4 5\\r\\n', 'output': ['10\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n5000\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n5000 5000 5000 5000\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n3366 3461 4 5 4370\\r\\n', 'output': ['3\\r\\n']}, {'input': '10\\r\\n8 2 10 3 4 6 1 7 9 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n551 3192 3213 2846 3068 1224 3447 1 10 9\\r\\n', 'output': ['7\\r\\n']}, {'input': '15\\r\\n4 1459 12 4281 3241 2748 10 3590 14 845 3518 1721 2 2880 1974\\r\\n', 'output': ['10\\r\\n']}, {'input': '15\\r\\n15 1 8 2 13 11 12 7 3 14 6 10 9 4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '15\\r\\n2436 2354 4259 1210 2037 2665 700 3578 2880 973 1317 1024 24 3621 4142\\r\\n', 'output': ['15\\r\\n']}, {'input': '30\\r\\n28 1 3449 9 3242 4735 26 3472 15 21 2698 7 4073 3190 10 3 29 1301 4526 22 345 3876 19 12 4562 2535 2 630 18 27\\r\\n', 'output': ['14\\r\\n']}, {'input': '100\\r\\n50 39 95 30 66 78 2169 4326 81 31 74 34 80 40 19 48 97 63 82 6 88 16 21 57 92 77 10 1213 17 93 32 91 38 4375 29 75 44 22 4 45 14 2395 3254 59 3379 2 85 96 8 83 27 94 1512 2960 100 9 73 79 7 25 55 69 90 99 51 87 98 62 18 35 43 4376 4668 28 72 56 4070 61 65 36 54 4106 11 24 15 86 70 71 4087 23 13 76 20 4694 26 4962 4726 37 14 64\\r\\n', 'output': ['18\\r\\n']}, {'input': '100\\r\\n340 14 3275 2283 2673 1107 817 2243 1226 32 2382 3638 4652 418 68 4962 387 764 4647 159 1846 225 2760 4904 3150 403 3 2439 91 4428 92 4705 75 348 1566 1465 69 6 49 4 62 4643 564 1090 3447 1871 2255 139 24 99 2669 969 86 61 4550 158 4537 3993 1589 872 2907 1888 401 80 1825 1483 63 1 2264 4068 4113 2548 41 885 4806 36 67 167 4447 34 1248 2593 82 202 81 1783 1284 4973 16 43 95 7 865 2091 3008 1793 20 947 4912 3604\\r\\n', 'output': ['70\\r\\n']}, {'input': '1\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n5000 5000\\r\\n', 'output': ['2\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n1 2 3 4 5 6 7 1000 10 10\\r\\n', 'output': ['2\\r\\n']}]","id":6} {"description":"\u00abOne dragon. Two dragon. Three dragon\u00bb, \u2014 the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.However, just counting dragons was boring as well, so she entertained herself at best she could. Tonight she imagined that all dragons were here to steal her, and she was fighting them off. Every k-th dragon got punched in the face with a frying pan. Every l-th dragon got his tail shut into the balcony door. Every m-th dragon got his paws trampled with sharp heels. Finally, she threatened every n-th dragon to call her mom, and he withdrew in panic.How many imaginary dragons suffered moral or physical damage tonight, if the princess counted a total of d dragons?","input_specification":"Input data contains integer numbers k,\u2009l,\u2009m,\u2009n and d, each number in a separate line (1\u2009\u2264\u2009k,\u2009l,\u2009m,\u2009n\u2009\u2264\u200910, 1\u2009\u2264\u2009d\u2009\u2264\u2009105).","output_specification":"Output the number of damaged dragons.","notes":"NoteIn the first case every first dragon got punched with a frying pan. Some of the dragons suffered from other reasons as well, but the pan alone would be enough.In the second case dragons 1, 7, 11, 13, 17, 19 and 23 escaped unharmed.","sample_inputs":["1\n2\n3\n4\n12","2\n3\n4\n5\n24"],"sample_outputs":["12","17"],"src_uid":"46bfdec9bfc1e91bd2f5022f3d3c8ce7","lang_cluster":"C++","difficulty":800,"human_solution":"#include \r\nusing namespace std;\r\n\r\nvoid solve() {\r\n int k, l, m, n, d;\r\n cin >> k >> l >> m >> n >> d;\r\n int ans = d;\r\n\r\n for (int i = 1; i <= d; i++) {\r\n if (i%k != 0 && i%l != 0 && i%m != 0 && i%n != 0) ans--;\r\n }\r\n\r\n cout << ans;\r\n}\r\n\r\nint main() {\r\n ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n if (fopen(\"T.INP\", \"r\")) {\r\n freopen(\"T.INP\", \"r\", stdin);\r\n freopen(\"T.OUT\", \"w\", stdout);\r\n }\r\n\r\n int tt = 1;\r\n \/\/ cin >> tt;\r\n while (tt--) solve();\r\n \r\n}","testcases":"[{'input': '1\\r\\n2\\r\\n3\\r\\n4\\r\\n12\\r\\n', 'output': ['12']}, {'input': '2\\r\\n3\\r\\n4\\r\\n5\\r\\n24\\r\\n', 'output': ['17']}, {'input': '1\\r\\n1\\r\\n1\\r\\n1\\r\\n100000\\r\\n', 'output': ['100000']}, {'input': '10\\r\\n9\\r\\n8\\r\\n7\\r\\n6\\r\\n', 'output': ['0']}, {'input': '8\\r\\n4\\r\\n4\\r\\n3\\r\\n65437\\r\\n', 'output': ['32718']}, {'input': '8\\r\\n4\\r\\n1\\r\\n10\\r\\n59392\\r\\n', 'output': ['59392']}, {'input': '4\\r\\n1\\r\\n8\\r\\n7\\r\\n44835\\r\\n', 'output': ['44835']}, {'input': '6\\r\\n1\\r\\n7\\r\\n2\\r\\n62982\\r\\n', 'output': ['62982']}, {'input': '2\\r\\n7\\r\\n4\\r\\n9\\r\\n56937\\r\\n', 'output': ['35246']}, {'input': '2\\r\\n9\\r\\n8\\r\\n1\\r\\n75083\\r\\n', 'output': ['75083']}, {'input': '8\\r\\n7\\r\\n7\\r\\n6\\r\\n69038\\r\\n', 'output': ['24656']}, {'input': '4\\r\\n4\\r\\n2\\r\\n3\\r\\n54481\\r\\n', 'output': ['36320']}, {'input': '6\\r\\n4\\r\\n9\\r\\n8\\r\\n72628\\r\\n', 'output': ['28244']}, {'input': '9\\r\\n7\\r\\n8\\r\\n10\\r\\n42357\\r\\n', 'output': ['16540']}, {'input': '5\\r\\n6\\r\\n4\\r\\n3\\r\\n60504\\r\\n', 'output': ['36302']}, {'input': '7\\r\\n2\\r\\n3\\r\\n8\\r\\n21754\\r\\n', 'output': ['15539']}, {'input': '1\\r\\n2\\r\\n10\\r\\n4\\r\\n39901\\r\\n', 'output': ['39901']}, {'input': '3\\r\\n4\\r\\n7\\r\\n1\\r\\n58048\\r\\n', 'output': ['58048']}, {'input': '9\\r\\n10\\r\\n4\\r\\n6\\r\\n52003\\r\\n', 'output': ['21956']}, {'input': '5\\r\\n10\\r\\n9\\r\\n3\\r\\n70149\\r\\n', 'output': ['32736']}, {'input': '5\\r\\n5\\r\\n5\\r\\n10\\r\\n55592\\r\\n', 'output': ['11118']}, {'input': '1\\r\\n5\\r\\n2\\r\\n6\\r\\n49547\\r\\n', 'output': ['49547']}, {'input': '3\\r\\n7\\r\\n7\\r\\n7\\r\\n84046\\r\\n', 'output': ['36019']}, {'input': '10\\r\\n2\\r\\n1\\r\\n8\\r\\n63537\\r\\n', 'output': ['63537']}, {'input': '7\\r\\n2\\r\\n10\\r\\n5\\r\\n81684\\r\\n', 'output': ['53678']}, {'input': '7\\r\\n1\\r\\n6\\r\\n8\\r\\n99831\\r\\n', 'output': ['99831']}, {'input': '3\\r\\n9\\r\\n3\\r\\n3\\r\\n61082\\r\\n', 'output': ['20360']}, {'input': '5\\r\\n5\\r\\n8\\r\\n9\\r\\n79228\\r\\n', 'output': ['29931']}, {'input': '1\\r\\n5\\r\\n5\\r\\n6\\r\\n89535\\r\\n', 'output': ['89535']}, {'input': '5\\r\\n5\\r\\n2\\r\\n1\\r\\n7682\\r\\n', 'output': ['7682']}, {'input': '7\\r\\n4\\r\\n8\\r\\n8\\r\\n25829\\r\\n', 'output': ['9224']}, {'input': '3\\r\\n4\\r\\n3\\r\\n3\\r\\n87079\\r\\n', 'output': ['43539']}, {'input': '5\\r\\n8\\r\\n4\\r\\n9\\r\\n5226\\r\\n', 'output': ['2438']}, {'input': '4\\r\\n9\\r\\n6\\r\\n6\\r\\n1070\\r\\n', 'output': ['415']}, {'input': '10\\r\\n10\\r\\n10\\r\\n10\\r\\n100000\\r\\n', 'output': ['10000']}, {'input': '1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['1']}, {'input': '10\\r\\n10\\r\\n10\\r\\n10\\r\\n1\\r\\n', 'output': ['0']}, {'input': '10\\r\\n10\\r\\n1\\r\\n10\\r\\n10\\r\\n', 'output': ['10']}, {'input': '10\\r\\n10\\r\\n1\\r\\n10\\r\\n100\\r\\n', 'output': ['100']}, {'input': '2\\r\\n2\\r\\n2\\r\\n2\\r\\n1\\r\\n', 'output': ['0']}]","id":7} {"description":"An African crossword is a rectangular table n\u2009\u00d7\u2009m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a letter should only be crossed out if and only if the corresponding column or row contains at least one more letter that is exactly the same. Besides, all such letters are crossed out simultaneously.When all repeated letters have been crossed out, we should write the remaining letters in a string. The letters that occupy a higher position follow before the letters that occupy a lower position. If the letters are located in one row, then the letter to the left goes first. The resulting word is the answer to the problem.You are suggested to solve an African crossword and print the word encrypted there.","input_specification":"The first line contains two integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100). Next n lines contain m lowercase Latin letters each. That is the crossword grid.","output_specification":"Print the encrypted word on a single line. It is guaranteed that the answer consists of at least one letter.","notes":null,"sample_inputs":["3 3\ncba\nbcd\ncbc","5 5\nfcofd\nooedo\nafaoa\nrdcdf\neofsf"],"sample_outputs":["abcd","codeforces"],"src_uid":"9c90974a0bb860a5e180760042fd5045","lang_cluster":"C++","difficulty":1100,"human_solution":"#include \n#include\nusing namespace std;\n\nint main()\n{\n int n,m;\n cin>>n>>m;\n int g[n][255]={0},g2[m][255]={0};\n char gc[n][m];\n for(int i=0;i>gc[i][j];\n g[i][gc[i][j]]++;\n g2[j][gc[i][j]]++;\n\n }\n for(int i=0;i2))\n cout<\n#include \n#include \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#define fname \"\"\n#define ull unsigned long long\n#define ll long long\n#define INF 1000*1000*1000\n\nint n, x, y, m, i, a[1001], j, mn = INF;\nbool was[1001][1001];\n\nint main () {\n #ifndef ONLINE_JUDGE\n freopen (\"a.in\", \"r\", stdin);\n freopen (\"a.out\", \"w\", stdout);\n #endif\n cin >> n >> m;;\n for (i = 1; i <= n; i++) \n cin >> a[i];\n \n for (i = 1; i <= m; i++) {\n cin >> x >> y;\n was[x][y] = true;\n was[y][x] = true;\n }\n for (i =1; i < n-1; i++)\n for (j = i+1; j < n; j++)\n for (int k = j+1; k <= n; k++) {\n if (was[i][j] && was[j][k] && was[k][i])\n mn = min(mn, a[i]+a[j]+a[k]); \n }\n if (mn == INF)\n cout << -1;\n else\n cout << mn; \n return 0;\n}\n","testcases":"[{'input': '3 3\\r\\n1 2 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['6\\r\\n']}, {'input': '3 2\\r\\n2 3 4\\r\\n2 3\\r\\n2 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 4\\r\\n1 1 1 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 3\\r\\n10 10 5 1\\r\\n2 1\\r\\n3 1\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 0\\r\\n9 8 2 10\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 3\\r\\n5 5 9 6\\r\\n3 2\\r\\n1 4\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 3\\r\\n5 1 10 1\\r\\n2 1\\r\\n3 2\\r\\n1 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 3\\r\\n1 2 8 6\\r\\n1 3\\r\\n1 4\\r\\n3 4\\r\\n', 'output': ['15\\r\\n']}, {'input': '4 4\\r\\n9 3 3 1\\r\\n1 2\\r\\n3 1\\r\\n3 2\\r\\n4 3\\r\\n', 'output': ['15\\r\\n']}, {'input': '4 3\\r\\n6 8 10 1\\r\\n2 3\\r\\n1 4\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 5\\r\\n4 10 3 9\\r\\n1 2\\r\\n3 1\\r\\n3 2\\r\\n2 4\\r\\n4 3\\r\\n', 'output': ['17\\r\\n']}, {'input': '4 2\\r\\n2 9 8 4\\r\\n1 3\\r\\n4 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 3\\r\\n5 3 4 4\\r\\n2 1\\r\\n4 1\\r\\n3 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '6 6\\r\\n39 15 73 82 37 40\\r\\n2 1\\r\\n5 1\\r\\n1 6\\r\\n2 6\\r\\n6 3\\r\\n4 6\\r\\n', 'output': ['94\\r\\n']}, {'input': '6 7\\r\\n85 2 34 6 83 61\\r\\n1 2\\r\\n2 3\\r\\n4 2\\r\\n4 3\\r\\n1 5\\r\\n4 5\\r\\n6 3\\r\\n', 'output': ['42\\r\\n']}, {'input': '6 8\\r\\n64 44 5 31 14 16\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n2 5\\r\\n3 5\\r\\n6 1\\r\\n6 3\\r\\n6 4\\r\\n', 'output': ['85\\r\\n']}, {'input': '6 8\\r\\n36 19 99 8 52 77\\r\\n2 1\\r\\n3 1\\r\\n4 2\\r\\n4 3\\r\\n1 5\\r\\n5 4\\r\\n1 6\\r\\n6 2\\r\\n', 'output': ['132\\r\\n']}, {'input': '6 5\\r\\n59 69 52 38 93 53\\r\\n4 2\\r\\n1 5\\r\\n6 1\\r\\n4 6\\r\\n5 6\\r\\n', 'output': ['205\\r\\n']}, {'input': '6 11\\r\\n95 81 74 94 60 69\\r\\n3 2\\r\\n1 4\\r\\n4 2\\r\\n3 4\\r\\n1 5\\r\\n5 2\\r\\n5 3\\r\\n1 6\\r\\n2 6\\r\\n3 6\\r\\n4 6\\r\\n', 'output': ['215\\r\\n']}, {'input': '6 8\\r\\n69 36 41 23 91 35\\r\\n1 2\\r\\n3 1\\r\\n3 2\\r\\n1 4\\r\\n3 4\\r\\n3 5\\r\\n5 4\\r\\n4 6\\r\\n', 'output': ['133\\r\\n']}, {'input': '6 6\\r\\n33 76 98 59 4 69\\r\\n1 2\\r\\n3 2\\r\\n5 1\\r\\n2 5\\r\\n4 5\\r\\n6 5\\r\\n', 'output': ['113\\r\\n']}, {'input': '6 6\\r\\n92 56 15 83 30 28\\r\\n3 1\\r\\n4 1\\r\\n2 5\\r\\n5 4\\r\\n2 6\\r\\n6 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '6 10\\r\\n17 5 55 24 55 74\\r\\n1 3\\r\\n2 3\\r\\n3 4\\r\\n5 1\\r\\n5 2\\r\\n5 3\\r\\n4 5\\r\\n6 2\\r\\n6 3\\r\\n6 5\\r\\n', 'output': ['115\\r\\n']}, {'input': '3 3\\r\\n1000000 1000000 1000000\\r\\n2 1\\r\\n1 3\\r\\n3 2\\r\\n', 'output': ['3000000\\r\\n']}, {'input': '3 0\\r\\n1 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 3\\r\\n100000 100000 100001\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['300001\\r\\n']}, {'input': '3 3\\r\\n1 1 999999\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['1000001\\r\\n']}, {'input': '3 3\\r\\n999999 1 1\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['1000001\\r\\n']}, {'input': '3 3\\r\\n1000000 1000000 1000000\\r\\n1 2\\r\\n2 3\\r\\n1 3\\r\\n', 'output': ['3000000\\r\\n']}]","id":9} {"description":"Little Petya loves inequations. Help him find n positive integers a1,\u2009a2,\u2009...,\u2009an, such that the following two conditions are satisfied: a12\u2009+\u2009a22\u2009+\u2009...\u2009+\u2009an2\u2009\u2265\u2009x a1\u2009+\u2009a2\u2009+\u2009...\u2009+\u2009an\u2009\u2264\u2009y","input_specification":"The first line contains three space-separated integers n, x and y (1\u2009\u2264\u2009n\u2009\u2264\u2009105,\u20091\u2009\u2264\u2009x\u2009\u2264\u20091012,\u20091\u2009\u2264\u2009y\u2009\u2264\u2009106). Please do not use the %lld specificator to read or write 64-bit integers in \u0421++. It is recommended to use cin, cout streams or the %I64d specificator.","output_specification":"Print n positive integers that satisfy the conditions, one integer per line. If such numbers do not exist, print a single number \"-1\". If there are several solutions, print any of them.","notes":null,"sample_inputs":["5 15 15","2 3 2","1 99 11"],"sample_outputs":["4\n4\n1\n1\n2","-1","11"],"src_uid":"138fd96bf5a677a6d59c20f88fd612f1","lang_cluster":"C++","difficulty":1400,"human_solution":"#include \n\nusing namespace std;\n\nint main(){\n long long n, x, y;\n\n cin >> n >> x >> y;\n\n\n long long a1 = y - n + 1;\n \n if (a1 > 0 && a1 * a1 >= x - n + 1){\n cout << a1 << \" \";\n for (int i = 1; i < n; i++){\n cout << 1 << \" \";\n }\n }\n else cout << -1;\n\n \n\n}\n","testcases":"[{'input': '5 15 15\\r\\n', 'output': ['11\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '2 3 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 99 11\\r\\n', 'output': ['11\\r\\n']}, {'input': '3 254 18\\r\\n', 'output': ['16\\r\\n1\\r\\n1\\r\\n']}, {'input': '4 324 77\\r\\n', 'output': ['74\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '5 315 90\\r\\n', 'output': ['86\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '6 225 59\\r\\n', 'output': ['54\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '7 351 29\\r\\n', 'output': ['23\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '100 913723780421 955988\\r\\n', 'output': ['-1\\r\\n']}, {'input': '200 894176381082 945808\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1000 824905348050 909242\\r\\n', 'output': ['-1\\r\\n']}, {'input': '31000 819461299082 936240\\r\\n', 'output': ['-1\\r\\n']}, {'input': '44000 772772899626 923074\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99999 681508136225 925533\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99976 664640815001 915230\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100000 729199960625 953931\\r\\n', 'output': ['-1\\r\\n']}, {'input': '50 890543266647 943735\\r\\n', 'output': ['-1\\r\\n']}, {'input': '60 817630084499 904288\\r\\n', 'output': ['904229\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '99999 716046078026 946193\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10000 950051796437 984705\\r\\n', 'output': ['-1\\r\\n']}, {'input': '999 992972391401 997478\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 983300308227 991615\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 912219830404 955103\\r\\n', 'output': ['955102\\r\\n1\\r\\n']}, {'input': '3 934371623645 966631\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 857839030421 926199\\r\\n', 'output': ['-1\\r\\n']}, {'input': '7 897398130730 947317\\r\\n', 'output': ['-1\\r\\n']}, {'input': '60 833021290059 912759\\r\\n', 'output': ['912700\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '1 860113420929 927423\\r\\n', 'output': ['927423\\r\\n']}, {'input': '2 933669982757 966267\\r\\n', 'output': ['966266\\r\\n1\\r\\n']}, {'input': '3 933157932003 966003\\r\\n', 'output': ['966001\\r\\n1\\r\\n1\\r\\n']}, {'input': '4 944626542564 971922\\r\\n', 'output': ['971919\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '7 937519681542 968262\\r\\n', 'output': ['968256\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '100000 1000000000000 1000000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99999 999999999999 999999\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11 10 10\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 5 10\\r\\n', 'output': ['10\\r\\n']}, {'input': '10 3 8\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 37 10\\r\\n', 'output': ['6\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '5 1 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1000000000000 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1000000\\r\\n', 'output': ['1000000\\r\\n']}, {'input': '100000 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100000 1000000000000 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1000000000000 1000000\\r\\n', 'output': ['1000000\\r\\n']}]","id":10} {"description":"Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya was delivered a string s, containing only digits. He needs to find a string that represents a lucky number without leading zeroes, is not empty, is contained in s as a substring the maximum number of times.Among all the strings for which the three conditions given above are fulfilled, Petya only needs the lexicographically minimum one. Find this string for Petya.","input_specification":"The single line contains a non-empty string s whose length can range from 1 to 50, inclusive. The string only contains digits. The string can contain leading zeroes.","output_specification":"In the only line print the answer to Petya's problem. If the sought string does not exist, print \"-1\" (without quotes).","notes":"NoteThe lexicographical comparison of strings is performed by the < operator in the modern programming languages. String x is lexicographically less than string y either if x is a prefix of y, or exists such i (1\u2009\u2264\u2009i\u2009\u2264\u2009min(|x|,\u2009|y|)), that xi\u2009<\u2009yi and for any j (1\u2009\u2264\u2009j\u2009<\u2009i) xj\u2009=\u2009yj. Here |a| denotes the length of string a.In the first sample three conditions are fulfilled for strings \"4\", \"7\" and \"47\". The lexicographically minimum one is \"4\".In the second sample s has no substrings which are lucky numbers.In the third sample the three conditions are only fulfilled for string \"7\".","sample_inputs":["047","16","472747"],"sample_outputs":["4","-1","7"],"src_uid":"639b8b8d0dc42df46b139f0aeb3a7a0a","lang_cluster":"C++","difficulty":1000,"human_solution":"#include\r\nusing namespace std;\r\nint main(){\r\n string s;\r\n cin>>s;\r\n int cnt=0;\r\n int cnt1=0;\r\n for(int i=0;icnt1){\r\n cout<<\"4\"<\r\n#include \r\n\r\n#define rep(i, n) for(int i = 0; i= b; i--)\r\n#define fast_io std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)\r\n#define pb push_back\r\n#define mk make_pair\r\n#define MOD 1000000007\r\n#define sortv(v) sort(v.begin(), v.end())\r\n#define reversev(v) sort(v.begin(), v.end())\r\n#define all(v) (v.begin(), v.end())\r\n\r\nusing namespace std;\r\n\r\ntypedef long long int ll;\r\ntypedef unsigned long long int ull;\r\ntypedef vector vi;\r\ntypedef vector vll;\r\ntypedef vector vvi;\r\ntypedef vector vvl;\r\ntypedef vector vb;\r\ntypedef set si;\r\ntypedef set sll;\r\ntypedef map mi;\r\ntypedef pair pi;\r\ntypedef map mll;\r\ntypedef pair pll;\r\nbool func(int mid,int k,int n){\r\n int total = mid;\r\n while(mid\/k!=0){\r\n mid = mid\/k;\r\n total += mid;\r\n }\r\n if(total>=n) return true;\r\n return false;\r\n}\r\nint main() {\r\n fast_io;\r\n int n,k;\r\n cin>>n>>k;\r\n int lo =0;\r\n int hi = n;\r\n int mid;\r\n int ans ;\r\n while(lo<=hi){\r\n mid = (lo+hi)>>1;\r\n if(func(mid,k,n)){\r\n ans = mid;\r\n hi = mid-1;\r\n }\r\n else{\r\n lo= mid+1;\r\n }\r\n }\r\n cout<\n#include \n\n#include \n#include \n#include \n\n#include \n#include \n\nusing namespace std;\n\ntypedef long long int64;\ntypedef unsigned long long uint64;\n\nconst int MAXN = 100 + 10;\n\nint n, b;\nint as[MAXN];\nint cs[MAXN];\n\nint main()\n{\n scanf(\"%d%d\", &n, &b);\n int mx = 0;\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &as[i]);\n mx = max(mx, as[i]);\n }\n\n for(int i = 0; b >= 0 && i < n; ++i) {\n cs[i] = mx - as[i];\n b -= cs[i];\n }\n\n if(b < 0) {\n cout << \"-1\" << endl;\n return 0;\n }\n\n double r = static_cast(b) \/ n;\n\n for(int i = 0; i < n; ++i) {\n printf(\"%.6f\\n\", cs[i] + r);\n }\n\n return 0;\n}\n","testcases":"[{'input': '5 50\\r\\n1 2 3 4 5\\r\\n', 'output': ['12.000000\\r\\n11.000000\\r\\n10.000000\\r\\n9.000000\\r\\n8.000000\\r\\n']}, {'input': '2 2\\r\\n1 100\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n1 1\\r\\n', 'output': ['1.000000\\r\\n1.000000\\r\\n']}, {'input': '3 2\\r\\n1 2 1\\r\\n', 'output': ['1.000000\\r\\n0.000000\\r\\n1.000000\\r\\n']}, {'input': '3 5\\r\\n1 2 1\\r\\n', 'output': ['2.000000\\r\\n1.000000\\r\\n2.000000\\r\\n']}, {'input': '10 95\\r\\n0 0 0 0 0 1 1 1 1 1\\r\\n', 'output': ['10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n']}, {'input': '3 5\\r\\n1 2 3\\r\\n', 'output': ['2.666667\\r\\n1.666667\\r\\n0.666667\\r\\n']}, {'input': '3 5\\r\\n1 3 2\\r\\n', 'output': ['2.666667\\r\\n0.666667\\r\\n1.666667\\r\\n']}, {'input': '3 5\\r\\n2 1 3\\r\\n', 'output': ['1.666667\\r\\n2.666667\\r\\n0.666667\\r\\n']}, {'input': '3 5\\r\\n2 3 1\\r\\n', 'output': ['1.666667\\r\\n0.666667\\r\\n2.666667\\r\\n']}, {'input': '3 5\\r\\n3 1 2\\r\\n', 'output': ['0.666667\\r\\n2.666667\\r\\n1.666667\\r\\n']}, {'input': '3 5\\r\\n3 2 1\\r\\n', 'output': ['0.666667\\r\\n1.666667\\r\\n2.666667\\r\\n']}, {'input': '2 1\\r\\n1 1\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '2 1\\r\\n2 2\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '3 2\\r\\n2 1 2\\r\\n', 'output': ['0.333333\\r\\n1.333333\\r\\n0.333333\\r\\n']}, {'input': '3 3\\r\\n2 2 1\\r\\n', 'output': ['0.666667\\r\\n0.666667\\r\\n1.666667\\r\\n']}, {'input': '3 3\\r\\n3 1 2\\r\\n', 'output': ['0.000000\\r\\n2.000000\\r\\n1.000000\\r\\n']}, {'input': '100 100\\r\\n37 97 75 52 33 29 51 22 33 37 45 96 96 60 82 58 86 71 28 73 38 50 6 6 90 17 26 76 13 41 100 47 17 93 4 1 56 16 41 74 25 17 69 61 39 37 96 73 49 93 52 14 62 24 91 30 9 97 52 100 6 16 85 8 12 26 10 3 94 63 80 27 29 78 9 48 79 64 60 18 98 75 81 35 24 81 2 100 23 70 21 60 98 38 29 29 58 37 49 72\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 100\\r\\n1 3 7 7 9 5 9 3 7 8 10 1 3 10 10 6 1 3 10 4 3 9 4 9 5 4 9 2 8 7 4 3 3 3 5 10 8 9 10 1 9 2 4 8 3 10 9 2 3 9 8 2 4 4 4 7 1 1 7 3 7 8 9 5 1 2 6 7 1 10 9 10 5 10 1 10 5 2 4 3 10 1 6 5 6 7 8 9 3 8 6 10 8 7 2 3 8 6 3 6\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 61\\r\\n81 80 83 72 87 76 91 92 77 93 77 94 76 73 71 88 88 76 87 73 89 73 85 81 79 90 76 73 82 93 79 93 71 75 72 71 78 85 92 89 88 93 74 87 71 94 74 87 85 89 90 93 86 94 92 87 90 91 75 73 90 84 92 94 92 79 74 85 74 74 89 76 84 84 84 83 86 84 82 71 76 74 83 81 89 73 73 74 71 77 90 94 73 94 73 75 93 89 84 92\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10 100\\r\\n52 52 51 52 52 52 51 51 52 52\\r\\n', 'output': ['9.700000\\r\\n9.700000\\r\\n10.700000\\r\\n9.700000\\r\\n9.700000\\r\\n9.700000\\r\\n10.700000\\r\\n10.700000\\r\\n9.700000\\r\\n9.700000\\r\\n']}, {'input': '10 100\\r\\n13 13 13 13 12 13 12 13 12 12\\r\\n', 'output': ['9.600000\\r\\n9.600000\\r\\n9.600000\\r\\n9.600000\\r\\n10.600000\\r\\n9.600000\\r\\n10.600000\\r\\n9.600000\\r\\n10.600000\\r\\n10.600000\\r\\n']}, {'input': '10 100\\r\\n50 51 47 51 48 46 49 51 46 51\\r\\n', 'output': ['9.000000\\r\\n8.000000\\r\\n12.000000\\r\\n8.000000\\r\\n11.000000\\r\\n13.000000\\r\\n10.000000\\r\\n8.000000\\r\\n13.000000\\r\\n8.000000\\r\\n']}, {'input': '10 100\\r\\n13 13 9 12 12 11 13 8 10 13\\r\\n', 'output': ['8.400000\\r\\n8.400000\\r\\n12.400000\\r\\n9.400000\\r\\n9.400000\\r\\n10.400000\\r\\n8.400000\\r\\n13.400000\\r\\n11.400000\\r\\n8.400000\\r\\n']}, {'input': '13 97\\r\\n52 52 51 51 52 52 51 52 51 51 52 52 52\\r\\n', 'output': ['7.076923\\r\\n7.076923\\r\\n8.076923\\r\\n8.076923\\r\\n7.076923\\r\\n7.076923\\r\\n8.076923\\r\\n7.076923\\r\\n8.076923\\r\\n8.076923\\r\\n7.076923\\r\\n7.076923\\r\\n7.076923\\r\\n']}, {'input': '17 99\\r\\n13 13 12 13 11 12 12 12 13 13 11 13 13 13 13 12 13\\r\\n', 'output': ['5.294118\\r\\n5.294118\\r\\n6.294118\\r\\n5.294118\\r\\n7.294118\\r\\n6.294118\\r\\n6.294118\\r\\n6.294118\\r\\n5.294118\\r\\n5.294118\\r\\n7.294118\\r\\n5.294118\\r\\n5.294118\\r\\n5.294118\\r\\n5.294118\\r\\n6.294118\\r\\n5.294118\\r\\n']}, {'input': '9 91\\r\\n52 51 50 52 52 51 50 48 51\\r\\n', 'output': ['8.888889\\r\\n9.888889\\r\\n10.888889\\r\\n8.888889\\r\\n8.888889\\r\\n9.888889\\r\\n10.888889\\r\\n12.888889\\r\\n9.888889\\r\\n']}, {'input': '17 91\\r\\n13 13 13 13 12 12 13 13 12 13 12 13 10 12 13 13 12\\r\\n', 'output': ['4.823529\\r\\n4.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n5.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n4.823529\\r\\n5.823529\\r\\n4.823529\\r\\n7.823529\\r\\n5.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n']}, {'input': '2 3\\r\\n1 1\\r\\n', 'output': ['1.500000\\r\\n1.500000\\r\\n']}, {'input': '2 90\\r\\n0 89\\r\\n', 'output': ['89.500000\\r\\n0.500000\\r\\n']}, {'input': '4 17\\r\\n3 4 8 1\\r\\n', 'output': ['5.250000\\r\\n4.250000\\r\\n0.250000\\r\\n7.250000\\r\\n']}, {'input': '2 9\\r\\n5 5\\r\\n', 'output': ['4.500000\\r\\n4.500000\\r\\n']}, {'input': '7 28\\r\\n1 3 9 10 9 6 10\\r\\n', 'output': ['9.857143\\r\\n7.857143\\r\\n1.857143\\r\\n0.857143\\r\\n1.857143\\r\\n4.857143\\r\\n0.857143\\r\\n']}, {'input': '5 11\\r\\n1 2 3 4 5\\r\\n', 'output': ['4.200000\\r\\n3.200000\\r\\n2.200000\\r\\n1.200000\\r\\n0.200000\\r\\n']}, {'input': '2 1\\r\\n1 1\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '5 3\\r\\n1 1 1 1 1\\r\\n', 'output': ['0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n']}, {'input': '3 1\\r\\n100 100 100\\r\\n', 'output': ['0.333333\\r\\n0.333333\\r\\n0.333333\\r\\n']}, {'input': '5 50\\r\\n2 2 3 2 2\\r\\n', 'output': ['10.200000\\r\\n10.200000\\r\\n9.200000\\r\\n10.200000\\r\\n10.200000\\r\\n']}, {'input': '3 3\\r\\n2 2 3\\r\\n', 'output': ['1.333333\\r\\n1.333333\\r\\n0.333333\\r\\n']}, {'input': '2 52\\r\\n2 100\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 2\\r\\n2 2 3\\r\\n', 'output': ['1.000000\\r\\n1.000000\\r\\n0.000000\\r\\n']}, {'input': '5 1\\r\\n1 1 1 1 1\\r\\n', 'output': ['0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n']}, {'input': '2 4\\r\\n1 2\\r\\n', 'output': ['2.500000\\r\\n1.500000\\r\\n']}, {'input': '5 49\\r\\n1 2 3 4 5\\r\\n', 'output': ['11.800000\\r\\n10.800000\\r\\n9.800000\\r\\n8.800000\\r\\n7.800000\\r\\n']}]","id":13} {"description":"Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two conditions: After the cutting each ribbon piece should have length a, b or c. After the cutting the number of ribbon pieces should be maximum. Help Polycarpus and find the number of ribbon pieces after the required cutting.","input_specification":"The first line contains four space-separated integers n, a, b and c (1\u2009\u2264\u2009n,\u2009a,\u2009b,\u2009c\u2009\u2264\u20094000) \u2014 the length of the original ribbon and the acceptable lengths of the ribbon pieces after the cutting, correspondingly. The numbers a, b and c can coincide.","output_specification":"Print a single number \u2014 the maximum possible number of ribbon pieces. It is guaranteed that at least one correct ribbon cutting exists.","notes":"NoteIn the first example Polycarpus can cut the ribbon in such way: the first piece has length 2, the second piece has length 3.In the second example Polycarpus can cut the ribbon in such way: the first piece has length 5, the second piece has length 2.","sample_inputs":["5 5 3 2","7 5 5 2"],"sample_outputs":["2","2"],"src_uid":"062a171cc3ea717ea95ede9d7a1c3a43","lang_cluster":"C++","difficulty":1300,"human_solution":"#include \n\nusing namespace std;\n\nint main()\n{\n int n,a,b,c;\n cin>>n>>a>>b>>c;\n int res=0;\n for(int i=0;i<=n;i++){\n for(int j=0;j<=n;j++ ){\n int k=(n-(i*a)-(j*b))\/c;\n if(k<0){k=0;}\n if((i*a)+(j*b)+(c*k)==n){\n res=max(res,i+j+k);\n }\n }\n }\n cout <\n#include \nusing namespace std;\n\nint main() {\n \n int n,m , a[51] ,b[51];\n cin>>n;\n for(int i=0 ;i>a[i];\n }\n \n cin>>m;\n for(int i=0 ;i>b[i];\n }\n \n int num[100]={0};\n int l=0;\n for(int i=0 ;i\r\n#include \r\nusing namespace std;\r\nint main()\r\n{\r\n map color;\r\n int num ;\r\n for(int i=0;i<4;i++)\r\n {\r\n cin>>num;\r\n color[num]=num;\r\n }\r\n cout<<4-color.size()<\r\n\r\ntypedef long long ll;\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n \tll n; cin >> n;\r\n \t\r\n \tif (n % 2 != 0 || n == 2) cout << \"NO\";\r\n\telse cout << \"YES\";\r\n \t\r\n return 0;\r\n}","testcases":"[{'input': '8\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '5\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '4\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '3\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '2\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '1\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '7\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '6\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '10\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '9\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '53\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '77\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '32\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '44\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '98\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '99\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '90\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '67\\r\\n', 'output': ['No', 'NO', 'no']}, {'input': '100\\r\\n', 'output': ['YES', 'Yes', 'yes']}, {'input': '88\\r\\n', 'output': ['YES', 'Yes', 'yes']}]","id":17} {"description":"A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous boards. Kalevitch decided to put an end to this tradition and to introduce a new attitude to chessboards.As before, the chessboard is a square-checkered board with the squares arranged in a 8\u2009\u00d7\u20098 grid, each square is painted black or white. Kalevitch suggests that chessboards should be painted in the following manner: there should be chosen a horizontal or a vertical line of 8 squares (i.e. a row or a column), and painted black. Initially the whole chessboard is white, and it can be painted in the above described way one or more times. It is allowed to paint a square many times, but after the first time it does not change its colour any more and remains black. Kalevitch paints chessboards neatly, and it is impossible to judge by an individual square if it was painted with a vertical or a horizontal stroke.Kalevitch hopes that such chessboards will gain popularity, and he will be commissioned to paint chessboards, which will help him ensure a comfortable old age. The clients will inform him what chessboard they want to have, and the painter will paint a white chessboard meeting the client's requirements.It goes without saying that in such business one should economize on everything \u2014 for each commission he wants to know the minimum amount of strokes that he has to paint to fulfill the client's needs. You are asked to help Kalevitch with this task.","input_specification":"The input file contains 8 lines, each of the lines contains 8 characters. The given matrix describes the client's requirements, W character stands for a white square, and B character \u2014 for a square painted black. It is guaranteed that client's requirments can be fulfilled with a sequence of allowed strokes (vertical\/column or horizontal\/row).","output_specification":"Output the only number \u2014 the minimum amount of rows and columns that Kalevitch has to paint on the white chessboard to meet the client's requirements.","notes":null,"sample_inputs":["WWWBWWBW\nBBBBBBBB\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW\nWWWBWWBW","WWWWWWWW\nBBBBBBBB\nWWWWWWWW\nWWWWWWWW\nWWWWWWWW\nWWWWWWWW\nWWWWWWWW\nWWWWWWWW"],"sample_outputs":["3","1"],"src_uid":"8b6ae2190413b23f47e2958a7d4e7bc0","lang_cluster":"C++","difficulty":1100,"human_solution":"#include \r\nusing namespace std;\r\ntypedef long long ll;\r\ntypedef vector vi;\r\ntypedef vector vl;\r\ntypedef pair pi;\r\ntypedef pair pl;\r\ntypedef vector> vpi;\r\ntypedef vector> vpl;\r\n#define pb(a) push_back(a)\r\n#define pbr(a,b) pb(make_pair(a,b))\r\n#define fr(i, a, b) for(int i = a; i <= b; i++)\r\n#define rf(i, a, b) for(int i = a; i >= b; i--)\r\n#define all(c) (c).begin(), (c).end()\r\n#define rall(c) (c).rbegin(), (c).rend()\r\n#define F first\r\n#define S second\r\n\r\nll M = 1e9 + 7; \/\/998244353;\r\nconst int N = 100001;\r\n\r\nll binpow(ll a, ll b){ ll ans = 1; while(b > 0){ if(b&1) ans = (ans * a) % M; a = (a*a) % M; b >>= 1; } return ans; }\r\nbool sS(pi p1, pi p2){ return (p1.S < p2.S); }\r\nbool sF(pi p1, pi p2){ return (p1.F < p2.F); }\r\n\r\n\r\nvoid solve()\r\n{\r\n string s[8];\r\n fr(i, 0, 7)\r\n cin >> s[i];\r\n int res{}, f;\r\n fr(i, 0, 7){\r\n f = 1;\r\n fr(j, 0, 7)\r\n if(s[i][j] == 'W'){\r\n f = 0;\r\n break;\r\n }\r\n if(f)\r\n res++;\r\n }\r\n fr(j, 0, 7){\r\n f = 1;\r\n fr(i, 0, 7)\r\n if(s[i][j] == 'W'){\r\n f = 0;\r\n break;\r\n }\r\n if(f)\r\n res++;\r\n }\r\n if(res == 16)\r\n res = 8;\r\n cout << res << \"\\n\";\r\n}\r\n\r\nint main()\r\n{\r\n ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);\r\n \r\n \/\/ freopen(\".in\", \"r\", stdin);\r\n \/\/ freopen(\".out\", \"w\", stdout);\r\n \r\n int t=1;\r\n \/\/ cin >> t;\r\n for(int i = 1; i <= t; i++)\r\n {\r\n \/\/ cout << \"t: \" << t << \"\\n\";\r\n solve();\r\n }\r\n return 0;\r\n}\r\n\r\n\r\n\r\n\r\n","testcases":"[{'input': 'WWWBWWBW\\r\\nBBBBBBBB\\r\\nWWWBWWBW\\r\\nWWWBWWBW\\r\\nWWWBWWBW\\r\\nWWWBWWBW\\r\\nWWWBWWBW\\r\\nWWWBWWBW\\r\\n', 'output': ['3']}, {'input': 'WWWWWWWW\\r\\nBBBBBBBB\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\n', 'output': ['1']}, {'input': 'WWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\nWWWWWWWW\\r\\n', 'output': ['0']}, {'input': 'BBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['8']}, {'input': 'BBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBW\\r\\n', 'output': ['14']}, {'input': 'BBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBWB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['14']}, {'input': 'BBBBBBBB\\r\\nWBBBWBBW\\r\\nBBBBBBBB\\r\\nWBBBWBBW\\r\\nWBBBWBBW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBBWBBW\\r\\n', 'output': ['9']}, {'input': 'BBBBBBBB\\r\\nWBBWWWBB\\r\\nBBBBBBBB\\r\\nWBBWWWBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBWWWBB\\r\\nBBBBBBBB\\r\\n', 'output': ['9']}, {'input': 'BBBBBWWB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBWWB\\r\\nBBBBBWWB\\r\\nBBBBBWWB\\r\\nBBBBBWWB\\r\\nBBBBBWWB\\r\\n', 'output': ['8']}, {'input': 'WWWWBBBB\\r\\nWWWWBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWWWWBBBB\\r\\nWWWWBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['8']}, {'input': 'BBBBBBBB\\r\\nWBWWBBBW\\r\\nBBBBBBBB\\r\\nWBWWBBBW\\r\\nWBWWBBBW\\r\\nWBWWBBBW\\r\\nWBWWBBBW\\r\\nBBBBBBBB\\r\\n', 'output': ['7']}, {'input': 'WBWWBBBW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBWWBBBW\\r\\nWBWWBBBW\\r\\n', 'output': ['9']}, {'input': 'BBWWBBBW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBWWBBBW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['11']}, {'input': 'WWBWBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWWBWBBBB\\r\\nBBBBBBBB\\r\\nWWBWBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['10']}, {'input': 'BBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWWBWBBBB\\r\\nWWBWBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWWBWBBBB\\r\\n', 'output': ['10']}, {'input': 'WBBWBBBW\\r\\nWBBWBBBW\\r\\nWBBWBBBW\\r\\nWBBWBBBW\\r\\nWBBWBBBW\\r\\nBBBBBBBB\\r\\nWBBWBBBW\\r\\nWBBWBBBW\\r\\n', 'output': ['6']}, {'input': 'BBBWBBBW\\r\\nBBBWBBBW\\r\\nBBBWBBBW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBWBBBW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['10']}, {'input': 'BBBBBBBB\\r\\nBBBWBBBB\\r\\nBBBWBBBB\\r\\nBBBWBBBB\\r\\nBBBBBBBB\\r\\nBBBWBBBB\\r\\nBBBWBBBB\\r\\nBBBWBBBB\\r\\n', 'output': ['9']}, {'input': 'BBBBBBBB\\r\\nWWWBBBBB\\r\\nWWWBBBBB\\r\\nBBBBBBBB\\r\\nWWWBBBBB\\r\\nWWWBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['9']}, {'input': 'WBBBBBWB\\r\\nBBBBBBBB\\r\\nWBBBBBWB\\r\\nWBBBBBWB\\r\\nWBBBBBWB\\r\\nWBBBBBWB\\r\\nWBBBBBWB\\r\\nBBBBBBBB\\r\\n', 'output': ['8']}, {'input': 'WBBBWWBW\\r\\nWBBBWWBW\\r\\nBBBBBBBB\\r\\nWBBBWWBW\\r\\nBBBBBBBB\\r\\nWBBBWWBW\\r\\nWBBBWWBW\\r\\nWBBBWWBW\\r\\n', 'output': ['6']}, {'input': 'WBBBBWBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBBBWBB\\r\\nWBBBBWBB\\r\\nBBBBBBBB\\r\\nWBBBBWBB\\r\\nBBBBBBBB\\r\\n', 'output': ['10']}, {'input': 'BBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBBWBBW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBBWBBW\\r\\nBBBBBBBB\\r\\n', 'output': ['11']}, {'input': 'BBBBBBBB\\r\\nBWBBBBBW\\r\\nBWBBBBBW\\r\\nBBBBBBBB\\r\\nBWBBBBBW\\r\\nBWBBBBBW\\r\\nBBBBBBBB\\r\\nBWBBBBBW\\r\\n', 'output': ['9']}, {'input': 'BBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBBWWWW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBBWWWW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['9']}, {'input': 'BWBBBWWB\\r\\nBWBBBWWB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBWBBBWWB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\n', 'output': ['10']}, {'input': 'BBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBWBBWBWB\\r\\n', 'output': ['12']}, {'input': 'BWBBBBWW\\r\\nBWBBBBWW\\r\\nBWBBBBWW\\r\\nBWBBBBWW\\r\\nBBBBBBBB\\r\\nBWBBBBWW\\r\\nBWBBBBWW\\r\\nBBBBBBBB\\r\\n', 'output': ['7']}, {'input': 'WWBBWWBB\\r\\nBBBBBBBB\\r\\nWWBBWWBB\\r\\nWWBBWWBB\\r\\nWWBBWWBB\\r\\nBBBBBBBB\\r\\nWWBBWWBB\\r\\nWWBBWWBB\\r\\n', 'output': ['6']}, {'input': 'BWBBWWWW\\r\\nBWBBWWWW\\r\\nBWBBWWWW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBWBBWWWW\\r\\nBBBBBBBB\\r\\n', 'output': ['7']}]","id":18} {"description":"Peter likes to travel by train. He likes it so much that on the train he falls asleep. Once in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started to look through the window and noticed that every railway station has a flag of a particular colour.The boy started to memorize the order of the flags' colours that he had seen. But soon he fell asleep again. Unfortunately, he didn't sleep long, he woke up and went on memorizing the colours. Then he fell asleep again, and that time he slept till the end of the journey.At the station he told his parents about what he was doing, and wrote two sequences of the colours that he had seen before and after his sleep, respectively.Peter's parents know that their son likes to fantasize. They give you the list of the flags' colours at the stations that the train passes sequentially on the way from A to B, and ask you to find out if Peter could see those sequences on the way from A to B, or from B to A. Remember, please, that Peter had two periods of wakefulness.Peter's parents put lowercase Latin letters for colours. The same letter stands for the same colour, different letters \u2014 for different colours.","input_specification":"The input data contains three lines. The first line contains a non-empty string, whose length does not exceed 105, the string consists of lowercase Latin letters \u2014 the flags' colours at the stations on the way from A to B. On the way from B to A the train passes the same stations, but in reverse order. The second line contains the sequence, written by Peter during the first period of wakefulness. The third line contains the sequence, written during the second period of wakefulness. Both sequences are non-empty, consist of lowercase Latin letters, and the length of each does not exceed 100 letters. Each of the sequences is written in chronological order. ","output_specification":"Output one of the four words without inverted commas: \u00abforward\u00bb \u2014 if Peter could see such sequences only on the way from A to B; \u00abbackward\u00bb \u2014 if Peter could see such sequences on the way from B to A; \u00abboth\u00bb \u2014 if Peter could see such sequences both on the way from A to B, and on the way from B to A; \u00abfantasy\u00bb \u2014 if Peter could not see such sequences. ","notes":"NoteIt is assumed that the train moves all the time, so one flag cannot be seen twice. There are no flags at stations A and B.","sample_inputs":["atob\na\nb","aaacaaa\naca\naa"],"sample_outputs":["forward","both"],"src_uid":"c3244e952830643938d51ce14f043d7d","lang_cluster":"C++","difficulty":1200,"human_solution":"#include \nusing namespace std;\n\n#define MAXN 100000\n#define MAXS 100\n\nchar flags[MAXN+10];\nchar a[MAXS+10], b[MAXS+10];\nint faila[MAXS], failb[MAXS];\n\nvoid kmpinit(char *s, int len, int *fail) {\n\tfail[0] = -1;\n\tfor (int i=1, pos = -1; i= lens) { return false; }\n\n\tfor (int i=0, pos=-1; i= matcha) { return true; }\n\t\t\tpos = failb[pos];\n\t\t}\n\t}\n\n\treturn false;\n}\n\nint main() {\n\tscanf(\"%s\", flags);\n\tscanf(\"%s\", a);\n\tscanf(\"%s\", b);\n\n\tint lena = strlen(a), lenb= strlen(b);\n\tint lenf = strlen(flags);\n\n\tkmpinit(a, lena, faila);\n\tkmpinit(b, lenb, failb);\n\n\tbool forward = possible(flags, lenf, lena, lenb);\n\treverse(flags, flags+lenf);\n\tbool backward = possible(flags, lenf, lena, lenb);\n\n\tif (forward) {\n\t\tprintf(\"%s\\n\", backward ? \"both\" : \"forward\");\n\t} else {\n\t\tprintf(\"%s\\n\", backward ? \"backward\" : \"fantasy\");\n\t}\n\n\treturn 0;\n\n}\n","testcases":"[{'input': 'atob\\r\\na\\r\\nb\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'aaacaaa\\r\\naca\\r\\naa\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aaa\\r\\naa\\r\\naa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'astalavista\\r\\nastla\\r\\nlavista\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'abacabadabacaba\\r\\nabacaba\\r\\nabacaba\\r\\n', 'output': ['both\\r\\n']}, {'input': 'a\\r\\na\\r\\na\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'ab\\r\\nb\\r\\na\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'aaa\\r\\naaaa\\r\\naaaa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'bbabbbbababbaabaabaa\\r\\nabb\\r\\nbaab\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'bbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbb\\r\\nbbbbb\\r\\n', 'output': ['both\\r\\n']}, {'input': 'babaabababaaaababaabababaabababababababbababbbabbaabababaababbaabbababaababaaabababaabbaababaaababaa\\r\\nabaabababaa\\r\\nabaabbaa\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'bbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbb\\r\\nbbbbb\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aababaaababaabbaabababaaababaabababbaabbabaabababaabbabbbababbababababababaabababaababaaaabababaabab\\r\\nabaabababaa\\r\\nabaabbaa\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'aaaa\\r\\naaa\\r\\naa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzz\\r\\nzzz\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzzzz\\r\\nzzzz\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzz\\r\\nzz\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aabaa\\r\\naab\\r\\nbaa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'aabaab\\r\\naba\\r\\nab\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'aab\\r\\nb\\r\\naa\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'abacaba\\r\\naca\\r\\nba\\r\\n', 'output': ['both\\r\\n']}]","id":19} {"description":"And again a misfortune fell on Poor Student. He is being late for an exam.Having rushed to a bus stop that is in point (0,\u20090), he got on a minibus and they drove along a straight line, parallel to axis OX, in the direction of increasing x.Poor Student knows the following: during one run the minibus makes n stops, the i-th stop is in point (xi,\u20090) coordinates of all the stops are different the minibus drives at a constant speed, equal to vb it can be assumed the passengers get on and off the minibus at a bus stop momentarily Student can get off the minibus only at a bus stop Student will have to get off the minibus at a terminal stop, if he does not get off earlier the University, where the exam will be held, is in point (xu,\u2009yu) Student can run from a bus stop to the University at a constant speed vs as long as needed a distance between two points can be calculated according to the following formula: Student is already on the minibus, so, he cannot get off at the first bus stop Poor Student wants to get to the University as soon as possible. Help him to choose the bus stop, where he should get off. If such bus stops are multiple, choose the bus stop closest to the University.","input_specification":"The first line contains three integer numbers: 2\u2009\u2264\u2009n\u2009\u2264\u2009100, 1\u2009\u2264\u2009vb,\u2009vs\u2009\u2264\u20091000. The second line contains n non-negative integers in ascending order: coordinates xi of the bus stop with index i. It is guaranteed that x1 equals to zero, and xn\u2009\u2264\u2009105. The third line contains the coordinates of the University, integers xu and yu, not exceeding 105 in absolute value. ","output_specification":"In the only line output the answer to the problem \u2014 index of the optimum bus stop.","notes":"NoteAs you know, students are a special sort of people, and minibuses usually do not hurry. That's why you should not be surprised, if Student's speed is higher than the speed of the minibus.","sample_inputs":["4 5 2\n0 2 4 6\n4 1","2 1 1\n0 100000\n100000 100000"],"sample_outputs":["3","2"],"src_uid":"15fa49860e978d3b3fb7a20bf9f8aa86","lang_cluster":"C++","difficulty":1200,"human_solution":"\/\/\/*Bismillahir Rahmanir Rahim***\/\/\/\n\/***Stay_Home_Stay_Safe***\/\n\/\/\/**Author Thasin Sheikh**\/\/\/\n#include\nusing namespace std;\n#define MAX 1e6+10\n#define MOD 1000000007\n#define PI 3.14159265359\n#define makefast__ ios_base::sync_with_stdio(false);\nusing ll=long long int ;\nusing dl =double;\nusing ld=long double;\nconst int N = 2e5 + 10;\nll aarray[200000+10];\nll magic[101][101];\nvectorprimes;\nbool prime[1000001];\ndl ttime[1000];\ndl atime[1000];\nll vb,vs,vx,vy;\nld dis(ll k)\n{\n ld x=(vx-aarray[k]);\n ld y=vy;\n return sqrt(x*x+y*y);\n}\nld calc(ll n)\n{\n ld t1=(ld)(aarray[n])\/vb;\n ld t2=(ld)dis(n)\/vs;\n return t1+t2;\n}\nint main()\n{\n \/\/freopen(\"input.txt\",\"r\",stdin);\n \/\/freopen(\"output.txt\",\"w\",stdout);\n makefast__\n string str;\n ll i,j,n,m,k=0;\n cin>>n>>vb>>vs;\n for(i=1; i<=n; i++)\n {\n cin>>aarray[i];\n }\n cin>>vx>>vy;\n ll ans=2;\n for(i=3; i<=n; i++)\n {\n if(calc(i)-calc(ans)<1e-14)\n {\n ans=i;\n }\n }\n cout<\r\n#include \r\nusing namespace std;\r\n \r\n\/\/ #define int long long\r\n#define MAX 1000100\r\n#define MD 1e9 + 7\r\n#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)\r\n \r\n \r\nsigned main(){\r\n \/\/ fast;\r\n string s1, s2;\r\n\r\n cin >> s1 >> s2;\r\n\r\n if (s1 == \"0\" && s2 == \"0\") {\r\n cout << \"OK\";\r\n return 0;\r\n }\r\n\r\n string ans, s3 = \"\";\r\n\r\n int zeros = 0;\r\n\r\n for (int i = 0; i < s1.length(); i++) {\r\n if (s1[i] == '0') zeros++;\r\n else s3 += s1[i];\r\n }\r\n\r\n sort(s3.begin(), s3.end());\r\n\r\n if (s1.length() > 1)\r\n for (int i = 0; i < zeros; i++)\r\n s3.insert(1, 1, '0');\r\n \r\n if (s3 == s2) cout << \"OK\";\r\n else cout << \"WRONG_ANSWER\";\r\n}","testcases":"[{'input': '3310\\r\\n1033\\r\\n', 'output': ['OK']}, {'input': '4\\r\\n5\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '40\\r\\n04\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '12\\r\\n12\\r\\n', 'output': ['OK']}, {'input': '432\\r\\n234\\r\\n', 'output': ['OK']}, {'input': '17109\\r\\n01179\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '888\\r\\n888\\r\\n', 'output': ['OK']}, {'input': '912\\r\\n9123\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '0\\r\\n00\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '11110\\r\\n1111\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '7391\\r\\n1397\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '201\\r\\n102\\r\\n', 'output': ['OK']}, {'input': '111111111\\r\\n111111111\\r\\n', 'output': ['OK']}, {'input': '32352320\\r\\n22203335\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '1000000000\\r\\n1\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '994321\\r\\n123499\\r\\n', 'output': ['OK']}, {'input': '10101\\r\\n10101\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '666\\r\\n0666\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '2\\r\\n02\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '313\\r\\n133\\r\\n', 'output': ['OK']}, {'input': '987235645\\r\\n234556789\\r\\n', 'output': ['OK']}, {'input': '90812\\r\\n010289\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '123\\r\\n321\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '707\\r\\n770\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '77774444\\r\\n47474747\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '1270\\r\\n1027\\r\\n', 'output': ['OK']}, {'input': '320\\r\\n23\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '123456789\\r\\n123456789\\r\\n', 'output': ['OK']}, {'input': '918273645\\r\\n546372819\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '300000003\\r\\n30000003\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '0\\r\\n0\\r\\n', 'output': ['OK']}, {'input': '0\\r\\n7\\r\\n', 'output': ['WRONG_ANSWER']}]","id":21} {"description":"Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three digits.","input_specification":"The first line contains integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of digits in the phone number. The second line contains n digits \u2014 the phone number to divide into groups.","output_specification":"Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.","notes":null,"sample_inputs":["6\n549871","7\n1198733"],"sample_outputs":["54-98-71","11-987-33"],"src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","lang_cluster":"C++","difficulty":1100,"human_solution":"#include \n#include \n#include \n#include \n#include \n#include \n#include \nusing namespace std;\n\nstring MakeLine(string str)\n{\n string s = \"\";\n if(str.size() < 4)\n {\n return str;\n }\n if(str.size()%2 == 0)\n {\n for(int i = 1; i <= str.size(); i++)\n {\n s += str[i-1];\n if(i%2 == 0 && i != str.size())\n s += \"-\";\n }\n }\n else\n {\n s += str[0];\n s += str[1];\n s += str[2];\n s += \"-\";\n for(int i = 1; i <= str.size() - 3; i++)\n {\n s += str[i+2];\n if(i%2 == 0 && i != str.size() - 3)\n s += \"-\";\n }\n }\n return s;\n}\n\nint main()\n{ \n int n;\n string str;\n cin >> n >> str;\n cout << MakeLine(str);\n return 0;\n}","testcases":"[{'input': '6\\r\\n549871\\r\\n', 'output': ['54-98-71']}, {'input': '7\\r\\n1198733\\r\\n', 'output': ['119-87-33']}, {'input': '2\\r\\n74\\r\\n', 'output': ['74']}, {'input': '2\\r\\n33\\r\\n', 'output': ['33']}, {'input': '3\\r\\n074\\r\\n', 'output': ['074']}, {'input': '3\\r\\n081\\r\\n', 'output': ['081']}, {'input': '4\\r\\n3811\\r\\n', 'output': ['38-11']}, {'input': '5\\r\\n21583\\r\\n', 'output': ['215-83']}, {'input': '8\\r\\n33408349\\r\\n', 'output': ['33-40-83-49']}, {'input': '9\\r\\n988808426\\r\\n', 'output': ['988-80-84-26']}, {'input': '10\\r\\n0180990956\\r\\n', 'output': ['01-80-99-09-56']}, {'input': '15\\r\\n433488906230138\\r\\n', 'output': ['433-48-89-06-23-01-38']}, {'input': '22\\r\\n7135498415686025907059\\r\\n', 'output': ['71-35-49-84-15-68-60-25-90-70-59']}, {'input': '49\\r\\n2429965524999668169991253653390090510755018570235\\r\\n', 'output': ['242-99-65-52-49-99-66-81-69-99-12-53-65-33-90-09-05-10-75-50-18-57-02-35']}, {'input': '72\\r\\n491925337784111770500147619881727525570039735507439360627744863794794290\\r\\n', 'output': ['49-19-25-33-77-84-11-17-70-50-01-47-61-98-81-72-75-25-57-00-39-73-55-07-43-93-60-62-77-44-86-37-94-79-42-90']}, {'input': '95\\r\\n32543414456047900690980198395035321172843693417425457554204776648220562494524275489599199209210\\r\\n', 'output': ['325-43-41-44-56-04-79-00-69-09-80-19-83-95-03-53-21-17-28-43-69-34-17-42-54-57-55-42-04-77-66-48-22-05-62-49-45-24-27-54-89-59-91-99-20-92-10']}, {'input': '97\\r\\n9362344595153688016434451101547661156123505108492010669557671355055642365998461003851354321478898\\r\\n', 'output': ['936-23-44-59-51-53-68-80-16-43-44-51-10-15-47-66-11-56-12-35-05-10-84-92-01-06-69-55-76-71-35-50-55-64-23-65-99-84-61-00-38-51-35-43-21-47-88-98']}, {'input': '98\\r\\n65521815795893886057122984634320900545031770769333931308009346017867969790810907868670369236928568\\r\\n', 'output': ['65-52-18-15-79-58-93-88-60-57-12-29-84-63-43-20-90-05-45-03-17-70-76-93-33-93-13-08-00-93-46-01-78-67-96-97-90-81-09-07-86-86-70-36-92-36-92-85-68']}, {'input': '99\\r\\n455213856470326729480192345541970106407563996625458559297407682539801838244443866898560852503660390\\r\\n', 'output': ['455-21-38-56-47-03-26-72-94-80-19-23-45-54-19-70-10-64-07-56-39-96-62-54-58-55-92-97-40-76-82-53-98-01-83-82-44-44-38-66-89-85-60-85-25-03-66-03-90']}, {'input': '100\\r\\n4004223124942730640235383244438257614581534320356060987241659784249551110165034719443327659510644224\\r\\n', 'output': ['40-04-22-31-24-94-27-30-64-02-35-38-32-44-43-82-57-61-45-81-53-43-20-35-60-60-98-72-41-65-97-84-24-95-51-11-01-65-03-47-19-44-33-27-65-95-10-64-42-24']}]","id":22} {"description":"Professor Vasechkin is studying evolution of worms. Recently he put forward hypotheses that all worms evolve by division. There are n forms of worms. Worms of these forms have lengths a1, a2, ..., an. To prove his theory, professor needs to find 3 different forms that the length of the first form is equal to sum of lengths of the other two forms. Help him to do this.","input_specification":"The first line contains integer n (3\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of worm's forms. The second line contains n space-separated integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u20091000) \u2014 lengths of worms of each form.","output_specification":"Output 3 distinct integers i j k (1\u2009\u2264\u2009i,\u2009j,\u2009k\u2009\u2264\u2009n) \u2014 such indexes of worm's forms that ai\u2009=\u2009aj\u2009+\u2009ak. If there is no such triple, output -1. If there are several solutions, output any of them. It possible that aj\u2009=\u2009ak.","notes":null,"sample_inputs":["5\n1 2 3 5 7","5\n1 8 1 5 1"],"sample_outputs":["3 2 1","-1"],"src_uid":"94a38067fc8dd8619fa6e5873ca60220","lang_cluster":"C++","difficulty":1200,"human_solution":"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\nint main(int argc, char const* argv[])\n{\n\tint n;\n\tcin >> n;\n\tint *a = new int[n];\n\tfor(int i = 0;i < n;i++){\n\t\tcin >> a[i];\n\t}\n\tfor (int i = 0; i < n; i++) {\n\t\tfor (int j = 0; j < n; j++) {\n\t\t\tfor (int k = 0; k < j; k++) {\n\t\t\t\tif (a[i] == a[j]+a[k] && i != j && i != k && j != k) {\n\t\t\t\t\tprintf(\"%d %d %d\\n\",i+1,j+1,k+1);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tprintf(\"-1\\n\");\n\treturn 0;\n}\n\n","testcases":"[{'input': '5\\r\\n1 2 3 5 7\\r\\n', 'output': ['3 2 1\\r\\n']}, {'input': '5\\r\\n1 8 1 5 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4\\r\\n303 872 764 401\\r\\n', 'output': ['-1\\r\\n']}, {'input': '6\\r\\n86 402 133 524 405 610\\r\\n', 'output': ['6 4 1\\r\\n']}, {'input': '8\\r\\n217 779 418 895 996 473 3 22\\r\\n', 'output': ['5 2 1\\r\\n']}, {'input': '10\\r\\n858 972 670 15 662 114 33 273 53 310\\r\\n', 'output': ['2 6 1\\r\\n']}, {'input': '100\\r\\n611 697 572 770 603 870 128 245 49 904 468 982 788 943 549 288 668 796 803 515 999 735 912 49 298 80 412 841 494 434 543 298 17 571 271 105 70 313 178 755 194 279 585 766 412 164 907 841 776 556 731 268 735 880 176 267 287 65 239 588 155 658 821 47 783 595 585 69 226 906 429 161 999 148 7 484 362 585 952 365 92 749 904 525 307 626 883 367 450 755 564 950 728 724 69 106 119 157 96 290\\r\\n', 'output': ['1 38 25\\r\\n']}, {'input': '100\\r\\n713 572 318 890 577 657 646 146 373 783 392 229 455 871 20 593 573 336 26 381 280 916 907 732 820 713 111 840 570 446 184 711 481 399 788 647 492 15 40 530 549 506 719 782 126 20 778 996 712 761 9 74 812 418 488 175 103 585 900 3 604 521 109 513 145 708 990 361 682 827 791 22 596 780 596 385 450 643 158 496 876 975 319 783 654 895 891 361 397 81 682 899 347 623 809 557 435 279 513 438\\r\\n', 'output': ['1 63 61\\r\\n']}, {'input': '100\\r\\n156 822 179 298 981 82 610 345 373 378 895 734 768 15 78 335 764 608 932 297 717 553 916 367 425 447 361 195 66 70 901 236 905 744 919 564 296 610 963 628 840 52 100 750 345 308 37 687 192 704 101 815 10 990 216 358 823 546 578 821 706 148 182 582 421 482 829 425 121 337 500 301 402 868 66 935 625 527 746 585 308 523 488 914 608 709 875 252 151 781 447 2 756 176 976 302 450 35 680 791\\r\\n', 'output': ['1 98 69\\r\\n']}, {'input': '100\\r\\n54 947 785 838 359 647 92 445 48 465 323 486 101 86 607 31 860 420 709 432 435 372 272 37 903 814 309 197 638 58 259 822 793 564 309 22 522 907 101 853 486 824 614 734 630 452 166 532 256 499 470 9 933 452 256 450 7 26 916 406 257 285 895 117 59 369 424 133 16 417 352 440 806 236 478 34 889 469 540 806 172 296 73 655 261 792 868 380 204 454 330 53 136 629 236 850 134 560 264 291\\r\\n', 'output': ['2 29 27\\r\\n']}, {'input': '99\\r\\n175 269 828 129 499 890 127 263 995 807 508 289 996 226 437 320 365 642 757 22 190 8 345 499 834 713 962 889 336 171 608 492 320 257 472 801 176 325 301 306 198 729 933 4 640 322 226 317 567 586 249 237 202 633 287 128 911 654 719 988 420 855 361 574 716 899 317 356 581 440 284 982 541 111 439 29 37 560 961 224 478 906 319 416 736 603 808 87 762 697 392 713 19 459 262 238 239 599 997\\r\\n', 'output': ['1 44 30\\r\\n']}, {'input': '98\\r\\n443 719 559 672 16 69 529 632 953 999 725 431 54 22 346 968 558 696 48 669 963 129 257 712 39 870 498 595 45 821 344 925 179 388 792 346 755 213 423 365 344 659 824 356 773 637 628 897 841 155 243 536 951 361 192 105 418 431 635 596 150 162 145 548 473 531 750 306 377 354 450 975 79 743 656 733 440 940 19 139 237 346 276 227 64 799 479 633 199 17 796 362 517 234 729 62 995 535\\r\\n', 'output': ['2 70 40\\r\\n']}, {'input': '97\\r\\n359 522 938 862 181 600 283 1000 910 191 590 220 761 818 903 264 751 751 987 316 737 898 168 925 244 674 34 950 754 472 81 6 37 520 112 891 981 454 897 424 489 238 363 709 906 951 677 828 114 373 589 835 52 89 97 435 277 560 551 204 879 469 928 523 231 163 183 609 821 915 615 969 616 23 874 437 844 321 78 53 643 786 585 38 744 347 150 179 988 985 200 11 15 9 547 886 752\\r\\n', 'output': ['1 23 10\\r\\n']}, {'input': '4\\r\\n303 872 764 401\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100\\r\\n328 397 235 453 188 254 879 225 423 36 384 296 486 592 231 849 856 255 213 898 234 800 701 529 951 693 507 326 15 905 618 348 967 927 28 979 752 850 343 35 84 302 36 390 482 826 249 918 91 289 973 457 557 348 365 239 709 565 320 560 153 130 647 708 483 469 788 473 322 844 830 562 611 961 397 673 69 960 74 703 369 968 382 451 328 160 211 230 566 208 7 545 293 73 806 375 157 410 303 58\\r\\n', 'output': ['1 79 6\\r\\n']}, {'input': '33\\r\\n52 145 137 734 180 847 178 286 716 134 181 630 358 764 593 762 785 28 1 468 189 540 764 485 165 656 114 58 628 108 605 584 257\\r\\n', 'output': ['8 30 7\\r\\n']}, {'input': '57\\r\\n75 291 309 68 444 654 985 158 514 204 116 918 374 806 176 31 49 455 269 66 722 713 164 818 317 295 546 564 134 641 28 13 987 478 146 219 213 940 289 173 157 666 168 391 392 71 870 477 446 988 414 568 964 684 409 671 454\\r\\n', 'output': ['2 41 29\\r\\n']}, {'input': '88\\r\\n327 644 942 738 84 118 981 686 530 404 137 197 434 16 693 183 423 325 410 345 941 329 7 106 79 867 584 358 533 675 192 718 641 329 900 768 404 301 101 538 954 590 401 954 447 14 559 337 756 586 934 367 538 928 945 936 770 641 488 579 206 869 902 139 216 446 723 150 829 205 373 578 357 368 960 40 121 206 503 385 521 161 501 694 138 370 709 308\\r\\n', 'output': ['1 77 61\\r\\n']}, {'input': '100\\r\\n804 510 266 304 788 625 862 888 408 82 414 470 777 991 729 229 933 406 601 1 596 720 608 706 432 361 527 548 59 548 474 515 4 991 263 568 681 24 117 563 576 587 281 643 904 521 891 106 842 884 943 54 605 815 504 757 311 374 335 192 447 652 633 410 455 402 382 150 432 836 413 819 669 875 638 925 217 805 632 520 605 266 728 795 162 222 603 159 284 790 914 443 775 97 789 606 859 13 851 47\\r\\n', 'output': ['1 77 42\\r\\n']}, {'input': '100\\r\\n449 649 615 713 64 385 927 466 138 126 143 886 80 199 208 43 196 694 92 89 264 180 617 970 191 196 910 150 275 89 693 190 191 99 542 342 45 592 114 56 451 170 64 589 176 102 308 92 402 153 414 675 352 157 69 150 91 288 163 121 816 184 20 234 836 12 593 150 793 439 540 93 99 663 186 125 349 247 476 106 77 523 215 7 363 278 441 745 337 25 148 384 15 915 108 211 240 58 23 408\\r\\n', 'output': ['1 6 5\\r\\n']}, {'input': '90\\r\\n881 436 52 308 97 261 153 931 670 538 702 156 114 445 154 685 452 76 966 790 93 42 547 65 736 364 136 489 719 322 239 628 696 735 55 703 622 375 100 188 804 341 546 474 484 446 729 290 974 301 602 225 996 244 488 983 882 460 962 754 395 617 61 640 534 292 158 375 632 902 420 979 379 38 100 67 963 928 190 456 545 571 45 716 153 68 844 2 102 116\\r\\n', 'output': ['1 14 2\\r\\n']}, {'input': '80\\r\\n313 674 262 240 697 146 391 221 793 504 896 818 92 899 86 370 341 339 306 887 937 570 830 683 729 519 240 833 656 847 427 958 435 704 853 230 758 347 660 575 843 293 649 396 437 787 654 599 35 103 779 783 447 379 444 585 902 713 791 150 851 228 306 721 996 471 617 403 102 168 197 741 877 481 968 545 331 715 236 654\\r\\n', 'output': ['1 13 8\\r\\n']}, {'input': '70\\r\\n745 264 471 171 946 32 277 511 269 469 89 831 69 2 369 407 583 602 646 633 429 747 113 302 722 321 344 824 241 372 263 287 822 24 652 758 246 967 219 313 882 597 752 965 389 775 227 556 95 904 308 340 899 514 400 187 275 318 621 546 659 488 199 154 811 1 725 79 925 82\\r\\n', 'output': ['1 63 60\\r\\n']}, {'input': '60\\r\\n176 502 680 102 546 917 516 801 392 435 635 492 398 456 653 444 472 513 634 378 273 276 44 920 68 124 800 167 825 250 452 264 561 344 98 933 381 939 426 51 568 548 206 887 342 763 151 514 156 354 486 546 998 649 356 438 295 570 450 589\\r\\n', 'output': ['2 26 20\\r\\n']}, {'input': '50\\r\\n608 92 889 33 146 803 402 91 868 400 828 505 375 558 584 129 361 776 974 123 765 804 326 186 61 927 904 511 762 775 640 593 300 664 897 461 869 911 986 789 607 500 309 457 294 104 724 471 216 155\\r\\n', 'output': ['3 25 11\\r\\n']}, {'input': '40\\r\\n40 330 98 612 747 336 640 381 991 366 22 167 352 12 868 166 603 40 313 869 609 981 609 804 54 729 8 854 347 300 828 922 39 633 695 988 4 530 545 176\\r\\n', 'output': ['5 10 8\\r\\n']}, {'input': '30\\r\\n471 920 308 544 347 222 878 671 467 332 215 180 681 114 151 203 492 951 653 614 453 510 540 422 399 532 113 198 932 825\\r\\n', 'output': ['2 21 9\\r\\n']}, {'input': '20\\r\\n551 158 517 475 595 108 764 961 590 297 761 841 659 568 82 888 733 214 993 359\\r\\n', 'output': ['3 20 2\\r\\n']}, {'input': '10\\r\\n983 748 726 406 196 993 2 251 66 263\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9\\r\\n933 266 457 863 768 257 594 136 145\\r\\n', 'output': ['-1\\r\\n']}, {'input': '8\\r\\n537 198 48 771 944 868 700 163\\r\\n', 'output': ['7 8 1\\r\\n']}, {'input': '7\\r\\n140 779 639 679 768 479 158\\r\\n', 'output': ['2 3 1\\r\\n']}, {'input': '6\\r\\n744 359 230 586 944 442\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5\\r\\n700 939 173 494 120\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4\\r\\n303 872 764 401\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3\\r\\n907 452 355\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3\\r\\n963 630 333\\r\\n', 'output': ['1 3 2\\r\\n']}, {'input': '3\\r\\n2 2 4\\r\\n', 'output': ['3 2 1\\r\\n']}, {'input': '3\\r\\n2 4 100\\r\\n', 'output': ['-1\\r\\n']}]","id":23} {"description":"Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only consisted of lowercase letters or, vice versa, only of uppercase ones. At that as little as possible letters should be changed in the word. For example, the word HoUse must be replaced with house, and the word ViP \u2014 with VIP. If a word contains an equal number of uppercase and lowercase letters, you should replace all the letters with lowercase ones. For example, maTRIx should be replaced by matrix. Your task is to use the given method on one given word.","input_specification":"The first line contains a word s \u2014 it consists of uppercase and lowercase Latin letters and possesses the length from 1 to 100.","output_specification":"Print the corrected word s. If the given word s has strictly more uppercase letters, make the word written in the uppercase register, otherwise - in the lowercase one.","notes":null,"sample_inputs":["HoUse","ViP","maTRIx"],"sample_outputs":["house","VIP","matrix"],"src_uid":"b432dfa66bae2b542342f0b42c0a2598","lang_cluster":"C++","difficulty":800,"human_solution":"#include \r\nusing namespace std;\r\n\r\n#define endl '\\n'\r\n#define int long long\r\n\r\nconst int MOD = 1e9 + 7;\r\nconst int INF = LLONG_MAX >> 1;\r\n\r\nsigned main() {\r\n ios::sync_with_stdio(false); cin.tie(NULL);\r\n\r\n string s; int upper = 0, lower = 0;\r\n cin>>s;\r\n for(int i = 0; i=97 && ((int)s[i])<=122) lower++;\r\n else upper++;\r\n }\r\n\r\n if(lower>=upper){\r\n for(int i = 0; ilower){\r\n for(int i = 0; i\r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#include \r\n#define ll long long\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n string x,y;\r\n cin>>x>>y;\r\n for(int i=0;i\n#include\n#include\nusing namespace std;\nint n,i,diff,x,y,ar[1000000];\nint main()\n{\n while(cin>>n)\n {\n for(i=0;i>ar[i];\n ar[n] = ar[0];\n diff = 99999999;\n for(i=0;i\nusing namespace std;\n\n\/\/#define DEBUG\n#define F first\n#define S second\n#define mp make_pair\n#define pb push_back\n#define ALL(x) x.begin(), x.end()\n#define SZ(x) x.size()\n#define what_is(x) cout << #x << \" = \" << x << endl\n#define IO_SPEED_UP ios::sync_with_stdio(false);cin.tie(NULL)\n\ntypedef long long ll;\ntypedef pair ii;\ntypedef vector vi;\ntypedef vector vb;\ntypedef vector vll;\ntypedef vector vii;\ntypedef vector vvi;\ntypedef vector vvii;\ntypedef vector vvll;\n\nconst int PINF = numeric_limits::max();\nconst int NINF = numeric_limits::min();\nconst ll MOD = 1E9 + 7;\n\nvoid print_vector(vector &v) {\n\tfor (int i = 0; i < (int) v.size(); ++i) {\n\t\tcout << v[i] << endl;\n\t}\n}\n\nint dirx[] = { -1, 1, 0, 0 };\nint diry[] = { 0, 0, -1, 1 };\n\nint main() {\n\t\/\/IO_SPEED_UP;\n\tif (fopen(\"input.txt\", \"r\")) {\n\t\tfreopen(\"input.txt\", \"r\", stdin);\n\t\tfreopen(\"output.txt\", \"w\", stdout);\n\t}\n\tint rows, cols;\n\tcin >> rows >> cols;\n\tint k;\n\tcin >> k;\n\tvii start(k);\n\tvvi g(rows, vi(cols, PINF));\n\tfor (int i = 0; i < k; ++i) {\n\t\tint x, y;\n\t\tcin >> x >> y;\n\t\tg[--x][--y] = 0;\n\t\tstart[i] = ii(x, y);\n\t}\n\tvector visited(rows, vb(cols, false));\n\tqueue q;\n\tfor (int i = 0; i < k; ++i) {\n\t\tii s = start[i];\n\t\tq.push(s);\n\t\tvisited[s.F][s.S] = true;\n\t}\n\twhile (!q.empty()) {\n\t\tii u = q.front();\n\t\tq.pop();\n\t\tfor (int j = 0; j < 4; ++j) {\n\t\t\tii child(u.F + dirx[j], u.S + diry[j]);\n\t\t\tif (child.F >= 0 && child.F < rows && child.S >= 0\n\t\t\t\t\t&& child.S < cols) {\n\t\t\t\tif (visited[child.F][child.S] == false) {\n\t\t\t\t\tq.push(child);\n\t\t\t\t\tg[child.F][child.S] = g[u.F][u.S] + 1;\n\t\t\t\t\tvisited[child.F][child.S] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tii last_point;\n\tint mx = -1;\n\tfor (int i = 0; i < rows; ++i) {\n\t\tfor (int j = 0; j < cols; ++j) {\n\t\t\tif (mx < g[i][j]) {\n\t\t\t\tmx = g[i][j];\n\t\t\t\tlast_point = ii(i, j);\n\t\t\t}\n\t\t}\n\t}\n\tcout << ++last_point.F << \" \" << ++last_point.S;\n\treturn 0;\n}\n","testcases":"[{'input': '3 3\\r\\n1\\r\\n2 2\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '3 3\\r\\n1\\r\\n1 1\\r\\n', 'output': ['3 3\\r\\n']}, {'input': '3 3\\r\\n2\\r\\n1 1 3 3\\r\\n', 'output': ['1 3\\r\\n']}, {'input': '1 1\\r\\n1\\r\\n1 1\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '2 2\\r\\n1\\r\\n2 2\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '2 2\\r\\n2\\r\\n1 1 2 1\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '2 2\\r\\n3\\r\\n1 2 2 1 1 1\\r\\n', 'output': ['2 2\\r\\n']}, {'input': '2 2\\r\\n4\\r\\n2 1 2 2 1 1 1 2\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '10 10\\r\\n1\\r\\n5 5\\r\\n', 'output': ['10 10\\r\\n']}, {'input': '10 10\\r\\n2\\r\\n7 8 1 9\\r\\n', 'output': ['3 1\\r\\n']}, {'input': '10 10\\r\\n3\\r\\n3 9 6 3 3 5\\r\\n', 'output': ['10 7\\r\\n']}, {'input': '10 10\\r\\n4\\r\\n5 3 4 7 7 5 8 5\\r\\n', 'output': ['10 10\\r\\n']}, {'input': '10 10\\r\\n5\\r\\n2 7 10 6 5 3 9 5 2 9\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '10 10\\r\\n6\\r\\n5 1 4 6 3 9 9 9 5 7 7 2\\r\\n', 'output': ['1 3\\r\\n']}, {'input': '10 10\\r\\n7\\r\\n5 8 4 6 4 1 6 2 1 10 3 2 7 10\\r\\n', 'output': ['10 5\\r\\n']}, {'input': '10 10\\r\\n8\\r\\n9 4 9 10 5 8 6 5 1 3 2 5 10 6 2 1\\r\\n', 'output': ['1 10\\r\\n']}, {'input': '10 10\\r\\n9\\r\\n10 1 10 4 8 4 6 6 1 9 10 10 7 7 6 5 7 10\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '10 10\\r\\n10\\r\\n7 2 1 9 5 8 6 10 9 4 10 8 6 8 8 7 4 1 9 5\\r\\n', 'output': ['1 3\\r\\n']}, {'input': '100 100\\r\\n1\\r\\n44 3\\r\\n', 'output': ['100 100\\r\\n']}, {'input': '100 100\\r\\n2\\r\\n79 84 76 63\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '100 100\\r\\n3\\r\\n89 93 99 32 32 82\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '100 100\\r\\n4\\r\\n72 12 1 66 57 67 25 67\\r\\n', 'output': ['100 100\\r\\n']}, {'input': '100 100\\r\\n5\\r\\n22 41 82 16 6 3 20 6 69 78\\r\\n', 'output': ['1 100\\r\\n']}, {'input': '100 100\\r\\n6\\r\\n92 32 90 80 32 40 24 19 36 37 39 13\\r\\n', 'output': ['1 100\\r\\n']}, {'input': '100 100\\r\\n7\\r\\n30 32 29 63 86 78 88 2 86 50 41 60 54 28\\r\\n', 'output': ['1 100\\r\\n']}, {'input': '100 100\\r\\n8\\r\\n40 43 96 8 17 63 61 59 16 69 4 95 30 62 12 91\\r\\n', 'output': ['100 100\\r\\n']}, {'input': '100 100\\r\\n9\\r\\n18 16 41 71 25 1 43 38 78 92 77 70 99 8 33 54 76 78\\r\\n', 'output': ['1 100\\r\\n']}, {'input': '100 100\\r\\n10\\r\\n58 98 33 62 75 13 94 86 81 42 14 53 12 66 7 14 3 63 87 37\\r\\n', 'output': ['40 1\\r\\n']}, {'input': '2000 2000\\r\\n1\\r\\n407 594\\r\\n', 'output': ['2000 2000\\r\\n']}, {'input': '2000 2000\\r\\n2\\r\\n1884 43 1235 1111\\r\\n', 'output': ['1 2000\\r\\n']}, {'input': '2000 2000\\r\\n3\\r\\n1740 1797 1279 1552 329 756\\r\\n', 'output': ['2000 1\\r\\n']}, {'input': '2000 2000\\r\\n4\\r\\n1844 1342 171 1810 1558 1141 1917 1999\\r\\n', 'output': ['530 1\\r\\n']}, {'input': '2000 2000\\r\\n5\\r\\n1846 327 1911 1534 134 1615 1664 682 1982 1112\\r\\n', 'output': ['346 1\\r\\n']}, {'input': '2000 2000\\r\\n6\\r\\n1744 1102 852 723 409 179 89 1085 997 1433 1082 1680\\r\\n', 'output': ['2000 1\\r\\n']}, {'input': '2000 2000\\r\\n7\\r\\n1890 22 288 1729 383 831 1192 1206 721 1376 969 492 510 1699\\r\\n', 'output': ['2000 2000\\r\\n']}, {'input': '2000 2000\\r\\n8\\r\\n286 381 572 1849 1703 1574 622 1047 1507 941 871 663 1930 120 1084 1830\\r\\n', 'output': ['1 1423\\r\\n']}, {'input': '2000 2000\\r\\n9\\r\\n226 531 56 138 722 405 1082 608 1355 1426 83 544 275 1268 683 412 1880 1049\\r\\n', 'output': ['1701 1\\r\\n']}, {'input': '2000 2000\\r\\n10\\r\\n763 851 1182 571 1758 389 247 1907 730 881 531 1970 1430 667 169 765 1729 120 129 967\\r\\n', 'output': ['2000 1793\\r\\n']}, {'input': '2000 2000\\r\\n10\\r\\n655 95 1640 1656 1344 79 666 1677 968 1180 522 1394 1850 1568 336 130 412 920 29 1664\\r\\n', 'output': ['2000 570\\r\\n']}, {'input': '10 1\\r\\n10\\r\\n4 1 6 1 10 1 9 1 1 1 7 1 5 1 2 1 8 1 3 1\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '1 10\\r\\n10\\r\\n1 10 1 4 1 3 1 7 1 6 1 1 1 8 1 2 1 9 1 5\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '1 100\\r\\n10\\r\\n1 68 1 18 1 43 1 12 1 64 1 34 1 23 1 70 1 46 1 33\\r\\n', 'output': ['1 100\\r\\n']}, {'input': '100 1\\r\\n10\\r\\n62 1 63 1 57 1 76 1 35 1 69 1 73 1 95 1 96 1 21 1\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '1 2000\\r\\n10\\r\\n1 1730 1 1374 1 831 1 1076 1 580 1 914 1 123 1 668 1 1288 1 160\\r\\n', 'output': ['1 2000\\r\\n']}, {'input': '2000 1\\r\\n10\\r\\n1058 1 1779 1 1995 1 1398 1 96 1 1599 1 1496 1 1659 1 385 1 1485 1\\r\\n', 'output': ['721 1\\r\\n']}, {'input': '5 5\\r\\n1\\r\\n1 1\\r\\n', 'output': ['5 5\\r\\n']}, {'input': '2 5\\r\\n10\\r\\n1 1 1 2 1 3 1 4 1 5 2 1 2 2 2 3 2 4 2 5\\r\\n', 'output': ['1 1\\r\\n']}, {'input': '1 10\\r\\n9\\r\\n1 1 1 2 1 3 1 4 1 6 1 7 1 8 1 9 1 10\\r\\n', 'output': ['1 5\\r\\n']}, {'input': '3 3\\r\\n5\\r\\n1 1 1 3 2 2 3 1 3 3\\r\\n', 'output': ['1 2\\r\\n']}, {'input': '999 999\\r\\n4\\r\\n1 499 499 1 499 999 999 499\\r\\n', 'output': ['500 500\\r\\n']}]","id":27} {"description":"Today the \u00abZ\u00bb city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly puts a small ball under one of the cups and starts to shuffle the cups around very quickly so that on the whole he makes exactly 3 shuffles. After that the spectators have exactly one attempt to guess in which cup they think the ball is and if the answer is correct they get a prize. Maybe you can try to find the ball too?","input_specification":"The first input line contains an integer from 1 to 3 \u2014 index of the cup which covers the ball before the shuffles. The following three lines describe the shuffles. Each description of a shuffle contains two distinct integers from 1 to 3 \u2014 indexes of the cups which the performer shuffled this time. The cups are numbered from left to right and are renumbered after each shuffle from left to right again. In other words, the cup on the left always has index 1, the one in the middle \u2014 index 2 and the one on the right \u2014 index 3.","output_specification":"In the first line output an integer from 1 to 3 \u2014 index of the cup which will have the ball after all the shuffles. ","notes":null,"sample_inputs":["1\n1 2\n2 1\n2 1","1\n2 1\n3 1\n1 3"],"sample_outputs":["2","2"],"src_uid":"88e6651e1b0481d711e89c8071be1edf","lang_cluster":"C++","difficulty":1000,"human_solution":"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef unsigned long long ull;\n\ntypedef vector vi;\ntypedef vector vvi;\ntypedef vector vs;\n\ntypedef tuple int2;\ntypedef tuple int3;\ntypedef tuple int4;\n\n#define all(v) (v).begin(), (v).end()\n#define est(v,e) (find(all(v), (e)) != (v).end())\n#define pb push_back\n#define eb emplace_back\n#define SZ(a) ((ll)((a).size()))\n#define For(i,a,b) for(ll i=(a);i<(b);++i)\n#define rep(i,n) For(i,0,n)\n#define tag(i,v) rep(i,SZ(v))\n#define trace(x) cerr << #x << \" = \" << (x) << endl\n#define tracev(x) cerr << #x << \" = \"; tag(__i, x) { cerr << x[__i] << \",\"; } cerr << endl\n#define initv(typ, v, n) vector v; rep(i,n) { typ tmp; cin >> tmp; x.pb(tmp); }\n#define fst get<0>\n#define snd get<1>\n#define thd get<2>\n\nconst ll inf = 1LL << 60;\nint toInt(string s) {int res;stringstream ss;ss<>res;return res;}\n\nint main(void) {\n\n #define int long long\n\n\n #ifdef ONLINE_JUDGE\n ifstream ifile(\"input.txt\");\n if(ifile) freopen(\"input.txt\", \"rt\", stdin);\n if(ifile) freopen(\"output.txt\", \"wt\", stdout);\n #endif\n\n int n;\n cin >> n;\n\n rep(i,3){\n\n int x,y;\n cin >> x >> y;\n\n if(x==n)n=y;\n else if(y==n)n=x;\n\n }\n\n cout << (n) << endl;\n\n return 0;\n\n}\n","testcases":"[{'input': '1\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n2 1\\r\\n3 1\\r\\n1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n3 1\\r\\n2 1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\n1 3\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n3 2\\r\\n3 1\\r\\n3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n2 1\\r\\n1 3\\r\\n1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n3 1\\r\\n2 3\\r\\n3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n1 3\\r\\n1 2\\r\\n2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n1 3\\r\\n3 2\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\n1 3\\r\\n1 3\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n2 3\\r\\n2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n1 3\\r\\n3 2\\r\\n2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n1 2\\r\\n2 1\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\n2 3\\r\\n1 3\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2\\r\\n3 1\\r\\n3 2\\r\\n2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '2\\r\\n1 3\\r\\n3 1\\r\\n3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n3 2\\r\\n1 3\\r\\n3 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n1 3\\r\\n1 2\\r\\n1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n3 2\\r\\n3 1\\r\\n1 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n1 3\\r\\n1 3\\r\\n', 'output': ['3\\r\\n']}]","id":28} {"description":"Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, that\u2019s why he decided to invent the function that will correct the words itself. Petya started from analyzing the case that happens to him most of the time, when all one needs is to delete one letter for the word to match a word from the dictionary. Thus, Petya faces one mini-task: he has a printed word and a word from the dictionary, and he should delete one letter from the first word to get the second one. And now the very non-trivial question that Petya faces is: which letter should he delete?","input_specification":"The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one.","output_specification":"In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible to make the first string identical to the second string by deleting one symbol, output one number 0.","notes":null,"sample_inputs":["abdrakadabra\nabrakadabra","aa\na","competition\ncodeforces"],"sample_outputs":["1\n3","2\n1 2","0"],"src_uid":"0df064fd0288c2ac4832efa227107a0e","lang_cluster":"C++","difficulty":1500,"human_solution":"#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n\n#define PB push_back\n#define MP make_pair\n#define F first\n#define S second\n\nusing namespace std;\nifstream fin(\"I.12\");\nifstream fout(\"O.12\");\nFILE *inn=fopen(\"\",\"r\"),*outt;\n\/\/inn=fopen(\"\",\"r\");\n\/\/outt=fopen(\"\",\"w\");\ntypedef long long ll;\ntypedef pair pii;\nconst int MAXN=1e6+5,MAXM=1e3+5,inf=2e9+1,MOD=1e9+7;\nconst ll C=701;\n\nint N,M,ans;\nll h1[MAXN],h2[MAXN],p[MAXN];\nstring str1,str2;\nvector res;\n\nbool cmpstr(int st1,int en1,int st2,int en2);\n\nint main(){\n\tios::sync_with_stdio(0);\n\tcin >> str1 >> str2;\n\tN=str1.size();\n\tM=str2.size();\n\th1[0]=str1[0];h2[0]=str2[0];p[0]=1;\n\tfor(int i=1;i\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define sz(a) int(a.size())\n#define FOR(i,n) for(int (i)=1;(i)<=(n);++(i))\n#define ll long long\n\nusing namespace std;\n\nint main ()\n{\n int n; scanf(\"%d\", &n);\n for (int i = 1; i <= n-1; i++)\n printf(\"%d \", (i*(i+1)\/2) % n + 1);\n return 0;\n}\n","testcases":"[{'input': '10\\r\\n', 'output': ['2 4 7 1 6 2 9 7 6\\r\\n']}, {'input': '3\\r\\n', 'output': ['2 1\\r\\n']}, {'input': '4\\r\\n', 'output': ['2 4 3\\r\\n']}, {'input': '5\\r\\n', 'output': ['2 4 2 1\\r\\n']}, {'input': '6\\r\\n', 'output': ['2 4 1 5 4\\r\\n']}, {'input': '7\\r\\n', 'output': ['2 4 7 4 2 1\\r\\n']}, {'input': '8\\r\\n', 'output': ['2 4 7 3 8 6 5\\r\\n']}, {'input': '9\\r\\n', 'output': ['2 4 7 2 7 4 2 1\\r\\n']}, {'input': '2\\r\\n', 'output': ['2\\r\\n']}, {'input': '11\\r\\n', 'output': ['2 4 7 11 5 11 7 4 2 1\\r\\n']}, {'input': '12\\r\\n', 'output': ['2 4 7 11 4 10 5 1 10 8 7\\r\\n']}, {'input': '13\\r\\n', 'output': ['2 4 7 11 3 9 3 11 7 4 2 1\\r\\n']}, {'input': '20\\r\\n', 'output': ['2 4 7 11 16 2 9 17 6 16 7 19 12 6 1 17 14 12 11\\r\\n']}, {'input': '25\\r\\n', 'output': ['2 4 7 11 16 22 4 12 21 6 17 4 17 6 21 12 4 22 16 11 7 4 2 1\\r\\n']}, {'input': '30\\r\\n', 'output': ['2 4 7 11 16 22 29 7 16 26 7 19 2 16 1 17 4 22 11 1 22 14 7 1 26 22 19 17 16\\r\\n']}, {'input': '35\\r\\n', 'output': ['2 4 7 11 16 22 29 2 11 21 32 9 22 1 16 32 14 32 16 1 22 9 32 21 11 2 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '40\\r\\n', 'output': ['2 4 7 11 16 22 29 37 6 16 27 39 12 26 1 17 34 12 31 11 32 14 37 21 6 32 19 7 36 26 17 9 2 36 31 27 24 22 21\\r\\n']}, {'input': '45\\r\\n', 'output': ['2 4 7 11 16 22 29 37 1 11 22 34 2 16 31 2 19 37 11 31 7 29 7 31 11 37 19 2 31 16 2 34 22 11 1 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '50\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 6 17 29 42 6 21 37 4 22 41 11 32 4 27 1 26 2 29 7 36 16 47 29 12 46 31 17 4 42 31 21 12 4 47 41 36 32 29 27 26\\r\\n']}, {'input': '55\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 1 12 24 37 51 11 27 44 7 26 46 12 34 2 26 51 22 49 22 51 26 2 34 12 46 26 7 44 27 11 51 37 24 12 1 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '60\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 7 19 32 46 1 17 34 52 11 31 52 14 37 1 26 52 19 47 16 46 17 49 22 56 31 7 44 22 1 41 22 4 47 31 16 2 49 37 26 16 7 59 52 46 41 37 34 32 31\\r\\n']}, {'input': '65\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 2 14 27 41 56 7 24 42 61 16 37 59 17 41 1 27 54 17 46 11 42 9 42 11 46 17 54 27 1 41 17 59 37 16 61 42 24 7 56 41 27 14 2 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '70\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 9 22 36 51 67 14 32 51 1 22 44 67 21 46 2 29 57 16 46 7 39 2 36 1 37 4 42 11 51 22 64 37 11 56 32 9 57 36 16 67 49 32 16 1 57 44 32 21 11 2 64 57 51 46 42 39 37 36\\r\\n']}, {'input': '75\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 4 17 31 46 62 4 22 41 61 7 29 52 1 26 52 4 32 61 16 47 4 37 71 31 67 29 67 31 71 37 4 47 16 61 32 4 52 26 1 52 29 7 61 41 22 4 62 46 31 17 4 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '80\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 12 26 41 57 74 12 31 51 72 14 37 61 6 32 59 7 36 66 17 49 2 36 71 27 64 22 61 21 62 24 67 31 76 42 9 57 26 76 47 19 72 46 21 77 54 32 11 71 52 34 17 1 66 52 39 27 16 6 77 69 62 56 51 47 44 42 41\\r\\n']}, {'input': '85\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 7 21 36 52 69 2 21 41 62 84 22 46 71 12 39 67 11 41 72 19 52 1 36 72 24 62 16 56 12 54 12 56 16 62 24 72 36 1 52 19 72 41 11 67 39 12 71 46 22 84 62 41 21 2 69 52 36 21 7 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '90\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 2 16 31 47 64 82 11 31 52 74 7 31 56 82 19 47 76 16 47 79 22 56 1 37 74 22 61 11 52 4 47 1 46 2 49 7 56 16 67 29 82 46 11 67 34 2 61 31 2 64 37 11 76 52 29 7 76 56 37 19 2 76 61 47 34 22 11 1 82 74 67 61 56 52 49 47 46\\r\\n']}, {'input': '95\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 11 26 42 59 77 1 21 42 64 87 16 41 67 94 27 56 86 22 54 87 26 61 2 39 77 21 61 7 49 92 41 86 37 84 37 86 41 92 49 7 61 21 77 39 2 61 26 87 54 22 86 56 27 94 67 41 16 87 64 42 21 1 77 59 42 26 11 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '96\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 10 25 41 58 76 95 19 40 62 85 13 38 64 91 23 52 82 17 49 82 20 55 91 32 70 13 53 94 40 83 31 76 26 73 25 74 28 79 35 88 46 5 61 22 80 43 7 68 34 1 65 34 4 71 43 16 86 61 37 14 88 67 47 28 10 89 73 58 44 31 19 8 94 85 77 70 64 59 55 52 50 49\\r\\n']}, {'input': '97\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 9 24 40 57 75 94 17 38 60 83 10 35 61 88 19 48 78 12 44 77 14 49 85 25 63 5 45 86 31 74 21 66 15 62 13 62 15 66 21 74 31 86 45 5 63 25 85 49 14 77 44 12 78 48 19 88 61 35 10 83 60 38 17 94 75 57 40 24 9 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '98\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 8 23 39 56 74 93 15 36 58 81 7 32 58 85 15 44 74 7 39 72 8 43 79 18 56 95 37 78 22 65 11 56 4 51 1 50 2 53 7 60 16 71 29 86 46 7 67 30 92 57 23 88 56 25 93 64 36 9 81 56 32 9 85 64 44 25 7 88 72 57 43 30 18 7 95 86 78 71 65 60 56 53 51 50\\r\\n']}, {'input': '99\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 7 22 38 55 73 92 13 34 56 79 4 29 55 82 11 40 70 2 34 67 2 37 73 11 49 88 29 70 13 56 1 46 92 40 88 38 88 40 92 46 1 56 13 70 29 88 49 11 73 37 2 67 34 2 70 40 11 82 55 29 4 79 56 34 13 92 73 55 38 22 7 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '100\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 6 21 37 54 72 91 11 32 54 77 1 26 52 79 7 36 66 97 29 62 96 31 67 4 42 81 21 62 4 47 91 36 82 29 77 26 76 27 79 32 86 41 97 54 12 71 31 92 54 17 81 46 12 79 47 16 86 57 29 2 76 51 27 4 82 61 41 22 4 87 71 56 42 29 17 6 96 87 79 72 66 61 57 54 52 51\\r\\n']}]","id":30} {"description":"The only difference between easy and hard versions is constraints.Nauuo is a girl who loves random picture websites.One day she made a random picture website by herself which includes $$$n$$$ pictures.When Nauuo visits the website, she sees exactly one picture. The website does not display each picture with equal probability. The $$$i$$$-th picture has a non-negative weight $$$w_i$$$, and the probability of the $$$i$$$-th picture being displayed is $$$\\frac{w_i}{\\sum_{j=1}^nw_j}$$$. That is to say, the probability of a picture to be displayed is proportional to its weight.However, Nauuo discovered that some pictures she does not like were displayed too often. To solve this problem, she came up with a great idea: when she saw a picture she likes, she would add $$$1$$$ to its weight; otherwise, she would subtract $$$1$$$ from its weight.Nauuo will visit the website $$$m$$$ times. She wants to know the expected weight of each picture after all the $$$m$$$ visits modulo $$$998244353$$$. Can you help her?The expected weight of the $$$i$$$-th picture can be denoted by $$$\\frac {q_i} {p_i}$$$ where $$$\\gcd(p_i,q_i)=1$$$, you need to print an integer $$$r_i$$$ satisfying $$$0\\le r_i<998244353$$$ and $$$r_i\\cdot p_i\\equiv q_i\\pmod{998244353}$$$. It can be proved that such $$$r_i$$$ exists and is unique.","input_specification":"The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\\le n\\le 2\\cdot 10^5$$$, $$$1\\le m\\le 3000$$$) \u2014 the number of pictures and the number of visits to the website. The second line contains $$$n$$$ integers $$$a_1,a_2,\\ldots,a_n$$$ ($$$a_i$$$ is either $$$0$$$ or $$$1$$$) \u2014 if $$$a_i=0$$$ , Nauuo does not like the $$$i$$$-th picture; otherwise Nauuo likes the $$$i$$$-th picture. It is guaranteed that there is at least one picture which Nauuo likes. The third line contains $$$n$$$ positive integers $$$w_1,w_2,\\ldots,w_n$$$ ($$$w_i \\geq 1$$$) \u2014 the initial weights of the pictures. It is guaranteed that the sum of all the initial weights does not exceed $$$998244352-m$$$.","output_specification":"The output contains $$$n$$$ integers $$$r_1,r_2,\\ldots,r_n$$$ \u2014 the expected weights modulo $$$998244353$$$.","notes":"NoteIn the first example, if the only visit shows the first picture with a probability of $$$\\frac 2 3$$$, the final weights are $$$(1,1)$$$; if the only visit shows the second picture with a probability of $$$\\frac1 3$$$, the final weights are $$$(2,2)$$$.So, both expected weights are $$$\\frac2 3\\cdot 1+\\frac 1 3\\cdot 2=\\frac4 3$$$ .Because $$$332748119\\cdot 3\\equiv 4\\pmod{998244353}$$$, you need to print $$$332748119$$$ instead of $$$\\frac4 3$$$ or $$$1.3333333333$$$.In the second example, there is only one picture which Nauuo likes, so every time Nauuo visits the website, $$$w_1$$$ will be increased by $$$1$$$.So, the expected weight is $$$1+2=3$$$.Nauuo is very naughty so she didn't give you any hint of the third example.","sample_inputs":["2 1\n0 1\n2 1","1 2\n1\n1","3 3\n0 1 1\n4 3 5"],"sample_outputs":["332748119\n332748119","3","160955686\n185138929\n974061117"],"src_uid":"ba9c136f84375cd317f0f8b53e3939c7","lang_cluster":"C++","difficulty":2600,"human_solution":"#include \n#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))\n#define CLEAR(a, x) memset((a), (x), sizeof (a))\n#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))\n#define FOR(i, l, r) for (int i = (l); i < (r); ++i)\n#define REP(i, l, r) for (int i = (l); i <= (r); ++i)\nusing namespace std;\n\ntypedef long long li;\ntypedef unsigned long long lu;\ntypedef pair pii;\n\nconst int mod = 998244353;\n\ninline int Add(int x) { return x >= mod ? x - mod : x; }\ninline int Sub(int x) { return x < 0 ? x + mod : x; }\ninline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }\ninline void Sub(int &x, int y) { x -= y; if (x < 0) x += mod; }\ninline int Mul(int x, int y) { return (lu)x * y % mod; }\ninline int Mul(int x, int y, int z) { return Mul(Mul(x, y), z); }\n\ninline void Max(int &x, int y) { if (y > x) x = y; }\ninline void Min(int &x, int y) { if (y < x) x = y; }\n\nint Pow(int x, int y) {\n int z = 1;\n for (; y; y >>= 1) {\n if (y & 1) z = Mul(z, x);\n x = Mul(x, x);\n }\n return z;\n}\n\n\/\/ ----------------------------------------\n\nconst int maxn = 2e5, maxm = 3000;\n\nint n, m;\nint type[maxn], wei[maxn];\n\/\/ int n1, w1[maxn], s1;\n\/\/ int n0, w0[maxn], s0;\nint s0, s1;\nint pro[maxm + 2][maxm + 2];\n\nint _inv[4 * maxm + 1], *inv = _inv + 2 * maxm;\n\nint main(void) {\n scanf(\"%d%d\", &n, &m);\n for (int i = 0; i < n; ++i) {\n scanf(\"%d\", type + i);\n }\n for (int i = 0; i < n; ++i) {\n scanf(\"%d\", wei + i);\n }\n for (int i = 0; i < n; ++i) {\n if (type[i] == 0) {\n \/\/ w0[n0++] = wei[i];\n Add(s0, wei[i]);\n } else {\n \/\/ w1[n1++] = wei[i];\n Add(s1, wei[i]);\n }\n }\n\n for (int i = -2 * m; i <= 2 * m; ++i) {\n int x = Sub(Add(Add(s0 + s1) + i));\n inv[i] = Pow(x, mod - 2);\n }\n\n int ans0 = 0, ans1 = 0;\n\n pro[0][0] = 1;\n for (int i = 0; i < m; ++i) {\n for (int j = 0; i + j < m; ++j) {\n int p = pro[i][j];\n \/\/ printf(\"pro[%d][%d] = %d\\n\", i, j, p);\n if (p == 0) continue;\n int ss0 = s0 - i;\n int ss1 = s1 + j;\n int pp0 = Mul(ss0, inv[j - i]);\n int pp1 = Mul(ss1, inv[j - i]);\n int p0 = Mul(p, pp0);\n int p1 = Mul(p, pp1);\n Add(pro[i + 1][j], p0);\n Add(pro[i][j + 1], p1);\n Add(ans0, p0);\n Add(ans1, p1);\n }\n }\n\n ans0 = Mul(ans0, Pow(s0, mod - 2));\n ans1 = Mul(ans1, Pow(s1, mod - 2));\n for (int i = 0; i < n; ++i) {\n int w = wei[i];\n if (type[i] == 0) {\n Sub(w, Mul(ans0, w));\n } else {\n Add(w, Mul(ans1, w));\n }\n printf(\"%d\\n\", w);\n }\n}\n","testcases":"[{'input': '2 1\\r\\n0 1\\r\\n2 1\\r\\n', 'output': ['332748119\\r\\n332748119']}, {'input': '1 2\\r\\n1\\r\\n1\\r\\n', 'output': ['3']}, {'input': '3 3\\r\\n0 1 1\\r\\n4 3 5\\r\\n', 'output': ['160955686\\r\\n185138929\\r\\n974061117']}, {'input': '5 5\\r\\n0 1 0 0 1\\r\\n9 8 3 8 8\\r\\n', 'output': ['45170585\\r\\n105647559\\r\\n680553097\\r\\n483815788\\r\\n105647559']}, {'input': '10 10\\r\\n0 1 0 0 1 1 1 1 1 1\\r\\n12 18 6 18 7 2 9 18 1 9\\r\\n', 'output': ['199115375\\r\\n823101465\\r\\n598679864\\r\\n797795239\\r\\n486469073\\r\\n424203836\\r\\n910672909\\r\\n823101465\\r\\n212101918\\r\\n910672909']}, {'input': '20 20\\r\\n1 1 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 0 1\\r\\n1 13 7 11 17 15 19 18 14 11 15 1 12 4 5 16 14 11 18 9\\r\\n', 'output': ['688505688\\r\\n964619120\\r\\n826562404\\r\\n585852097\\r\\n851622699\\r\\n345141790\\r\\n104431483\\r\\n414170148\\r\\n349014804\\r\\n585852097\\r\\n516550769\\r\\n688505688\\r\\n13942874\\r\\n670143860\\r\\n447795381\\r\\n684086734\\r\\n654880455\\r\\n585852097\\r\\n20914311\\r\\n207085074']}, {'input': '30 50\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0\\r\\n1 2 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 1 2 1 1 2 1 2 2 1 1 2 2 2\\r\\n', 'output': ['346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n542025302\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n693292404\\r\\n693292404']}, {'input': '40 40\\r\\n1 1 1 1 0 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 1 1 1 1 1 1 1 1 1\\r\\n28 13 22 35 22 13 23 35 14 36 30 10 10 15 3 9 35 35 9 29 14 28 8 29 22 30 4 31 39 24 4 19 37 4 20 7 11 17 3 25\\r\\n', 'output': ['368107101\\r\\n848286965\\r\\n360530176\\r\\n210572788\\r\\n199380339\\r\\n848286965\\r\\n195418938\\r\\n210572788\\r\\n683175727\\r\\n45461550\\r\\n37884625\\r\\n544374860\\r\\n345376326\\r\\n518064489\\r\\n502910639\\r\\n510487564\\r\\n210572788\\r\\n210572788\\r\\n510487564\\r\\n202995863\\r\\n683175727\\r\\n526005255\\r\\n675598802\\r\\n202995863\\r\\n360530176\\r\\n37884625\\r\\n337799401\\r\\n871017740\\r\\n548372189\\r\\n30307700\\r\\n337799401\\r\\n855863890\\r\\n878594665\\r\\n337799401\\r\\n690752652\\r\\n840710040\\r\\n180265088\\r\\n187842013\\r\\n502910639\\r\\n863440815']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n13 18 27 40 3 1 20 11 25 11 2 31 22 15 36 12 11 24 8 39 31 36 19 24 10 39 27 4 10 22 14 3 25 5 24 19 20 33 17 19 30 15 37 33 3 27 26 29 37 34\\r\\n', 'output': ['30685719\\r\\n733580163\\r\\n601248068\\r\\n631933787\\r\\n621385537\\r\\n539876630\\r\\n815089070\\r\\n947421165\\r\\n519739161\\r\\n947421165\\r\\n81508907\\r\\n764265882\\r\\n896597977\\r\\n112194626\\r\\n468915973\\r\\n489053442\\r\\n947421165\\r\\n978106884\\r\\n326035628\\r\\n92057157\\r\\n764265882\\r\\n468915973\\r\\n275212440\\r\\n978106884\\r\\n407544535\\r\\n92057157\\r\\n601248068\\r\\n163017814\\r\\n407544535\\r\\n896597977\\r\\n570562349\\r\\n621385537\\r\\n519739161\\r\\n702894444\\r\\n978106884\\r\\n275212440\\r\\n815089070\\r\\n845774789\\r\\n193703533\\r\\n275212440\\r\\n224389252\\r\\n112194626\\r\\n10548250\\r\\n845774789\\r\\n621385537\\r\\n601248068\\r\\n61371438\\r\\n...']}, {'input': '50 50\\r\\n0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0\\r\\n2 50 37 21 21 2 26 49 15 44 8 27 30 28 26 40 26 45 41 37 27 34 8 35 2 23 2 49 13 1 39 37 12 42 7 11 4 50 42 21 27 50 28 31 17 22 10 43 46 13\\r\\n', 'output': ['380563607\\r\\n529890998\\r\\n551838435\\r\\n502062638\\r\\n635094670\\r\\n380563607\\r\\n954349479\\r\\n816391328\\r\\n358616170\\r\\n386444530\\r\\n907437062\\r\\n645509106\\r\\n717232340\\r\\n336668733\\r\\n954349479\\r\\n623561669\\r\\n954349479\\r\\n77604157\\r\\n314721296\\r\\n453480088\\r\\n645509106\\r\\n480115201\\r\\n907437062\\r\\n725742999\\r\\n380563607\\r\\n362831759\\r\\n725981442\\r\\n838731371\\r\\n976296916\\r\\n362990721\\r\\n932402042\\r\\n551838435\\r\\n286892936\\r\\n5880923\\r\\n832850448\\r\\n998164872\\r\\n761127214\\r\\n529890998\\r\\n5880923\\r\\n502062638\\r\\n645509106\\r\\n181137696\\r\\n181296658\\r\\n408391967\\r\\n739179777\\r\\n193222265\\r\\n904573682\\r...']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n1 2 2 1 2 2 2 1 1 1\\r\\n', 'output': ['665496237\\r\\n332748121\\r\\n332748121\\r\\n665496237\\r\\n332748121\\r\\n332748121\\r\\n332748121\\r\\n665496237\\r\\n665496237\\r\\n665496237']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 0 1 1\\r\\n2 1 2 2 1 1 1 1 1 1\\r\\n', 'output': ['771370640\\r\\n385685320\\r\\n771370640\\r\\n771370640\\r\\n385685320\\r\\n385685320\\r\\n385685320\\r\\n635246407\\r\\n385685320\\r\\n385685320']}, {'input': '10 10\\r\\n0 0 0 1 0 0 0 0 0 0\\r\\n2 2 2 2 2 2 2 1 2 2\\r\\n', 'output': ['973938381\\r\\n973938381\\r\\n973938381\\r\\n791643586\\r\\n973938381\\r\\n973938381\\r\\n973938381\\r\\n986091367\\r\\n973938381\\r\\n973938381']}, {'input': '10 10\\r\\n0 0 1 0 0 0 1 0 0 0\\r\\n2 1 2 1 1 2 1 1 1 1\\r\\n', 'output': ['44896189\\r\\n521570271\\r\\n482402083\\r\\n521570271\\r\\n521570271\\r\\n44896189\\r\\n740323218\\r\\n521570271\\r\\n521570271\\r\\n521570271']}, {'input': '10 10\\r\\n1 0 0 0 1 1 1 0 1 0\\r\\n1 2 1 2 1 1 2 2 2 1\\r\\n', 'output': ['910950063\\r\\n595918255\\r\\n797081304\\r\\n595918255\\r\\n910950063\\r\\n910950063\\r\\n823655773\\r\\n595918255\\r\\n823655773\\r\\n797081304']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n17 10 8 34 5 4 3 44 20 14\\r\\n', 'output': ['709444118\\r\\n6278277\\r\\n803618104\\r\\n420643883\\r\\n502261315\\r\\n401809052\\r\\n301356789\\r\\n426922160\\r\\n12556554\\r\\n408087329']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 0 1\\r\\n40 36 29 4 36 35 9 38 40 18\\r\\n', 'output': ['59109317\\r\\n951618303\\r\\n17898146\\r\\n105735367\\r\\n951618303\\r\\n675623373\\r\\n487465664\\r\\n505363810\\r\\n736385984\\r\\n974931328']}, {'input': '10 10\\r\\n0 0 0 0 0 0 0 1 0 0\\r\\n8 33 37 18 30 48 45 34 25 48\\r\\n', 'output': ['211347083\\r\\n497465085\\r\\n104016450\\r\\n725092025\\r\\n542990473\\r\\n269838145\\r\\n315363533\\r\\n227335634\\r\\n286118002\\r\\n269838145']}, {'input': '10 10\\r\\n0 0 1 0 0 0 0 0 1 0\\r\\n47 34 36 9 3 16 17 46 47 1\\r\\n', 'output': ['167709201\\r\\n57603825\\r\\n597597985\\r\\n690531016\\r\\n562925123\\r\\n673030499\\r\\n527924089\\r\\n312815611\\r\\n253346183\\r\\n853137943']}, {'input': '10 10\\r\\n1 0 0 1 1 0 1 0 0 1\\r\\n24 7 10 9 6 13 27 17 6 39\\r\\n', 'output': ['976715988\\r\\n573793375\\r\\n391885813\\r\\n865390672\\r\\n244178997\\r\\n209978251\\r\\n599683310\\r\\n965679188\\r\\n634429229\\r\\n89796951']}, {'input': '10 10\\r\\n0 0 0 0 0 1 0 0 0 0\\r\\n34 34 34 34 34 34 34 34 34 34\\r\\n', 'output': ['971203339\\r\\n971203339\\r\\n971203339\\r\\n971203339\\r\\n971203339\\r\\n754874965\\r\\n971203339\\r\\n971203339\\r\\n971203339\\r\\n971203339']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n43 43 43 43 43 43 43 43 43 43\\r\\n', 'output': ['44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 2 2 2 1 1 2 1 1 1 2 1 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 1\\r\\n', 'output': ['260411572\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n260411572\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n260411572\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n260411572']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1\\r\\n2 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 2 2 2 2 1 2 1 2 1 1 1 1 2 1\\r\\n', 'output': ['720162001\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n720162001\\r\\n720162001\\r\\n720162001\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n720162001\\r\\n427819009\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177']}, {'input': '30 30\\r\\n0 0 0 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\\r\\n2 1 1 2 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 1 2 1 1 1 1 1 2 1 1 1\\r\\n', 'output': ['188114875\\r\\n593179614\\r\\n593179614\\r\\n550614566\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n593179614']}, {'input': '30 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 1 1 1 2 1 2 2 1 2 1 2 1 1 2 2 1 2 1 2 1 2 2 2 1 1 2 1 2 2\\r\\n', 'output': ['593179614\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n275307283\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n275307283\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875']}, {'input': '30 30\\r\\n1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0\\r\\n1 1 1 2 2 1 2 1 2 1 1 2 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1\\r\\n', 'output': ['297674502\\r\\n297674502\\r\\n297674502\\r\\n101192689\\r\\n595349004\\r\\n549718521\\r\\n101192689\\r\\n297674502\\r\\n595349004\\r\\n297674502\\r\\n549718521\\r\\n101192689\\r\\n101192689\\r\\n101192689\\r\\n549718521\\r\\n595349004\\r\\n297674502\\r\\n549718521\\r\\n297674502\\r\\n549718521\\r\\n297674502\\r\\n101192689\\r\\n549718521\\r\\n595349004\\r\\n297674502\\r\\n101192689\\r\\n297674502\\r\\n101192689\\r\\n297674502\\r\\n549718521']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n23 45 44 49 17 36 32 26 40 8 36 11 5 19 41 16 7 38 23 40 13 16 24 44 22 13 1 2 32 31\\r\\n', 'output': ['42365832\\r\\n603712812\\r\\n124449607\\r\\n524276926\\r\\n161519661\\r\\n283321379\\r\\n362757265\\r\\n481911094\\r\\n203885493\\r\\n839372581\\r\\n283321379\\r\\n280673490\\r\\n399827319\\r\\n121801718\\r\\n683148698\\r\\n680500809\\r\\n360109376\\r\\n243603436\\r\\n42365832\\r\\n203885493\\r\\n240955547\\r\\n680500809\\r\\n521629037\\r\\n124449607\\r\\n561346980\\r\\n240955547\\r\\n479263205\\r\\n958526410\\r\\n362757265\\r\\n881738413']}, {'input': '30 30\\r\\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n41 39 15 34 45 27 18 7 48 33 46 11 24 16 35 43 7 31 26 17 30 15 5 9 29 20 21 37 3 7\\r\\n', 'output': ['61128841\\r\\n655563720\\r\\n98563838\\r\\n955457225\\r\\n295691514\\r\\n377063779\\r\\n916872088\\r\\n578393446\\r\\n115755411\\r\\n17191573\\r\\n235712813\\r\\n338478642\\r\\n556999882\\r\\n38585137\\r\\n895478524\\r\\n415648916\\r\\n578393446\\r\\n137148975\\r\\n437042480\\r\\n976850789\\r\\n197127676\\r\\n98563838\\r\\n698350848\\r\\n458436044\\r\\n257106377\\r\\n796914686\\r\\n736935985\\r\\n775521122\\r\\n818308250\\r\\n578393446']}, {'input': '30 30\\r\\n0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n29 38 18 19 46 28 12 5 46 17 31 20 24 33 9 6 47 2 2 41 34 2 50 5 47 10 40 21 49 28\\r\\n', 'output': ['528451192\\r\\n658031067\\r\\n259159750\\r\\n828137710\\r\\n218632982\\r\\n957717585\\r\\n838269402\\r\\n848401094\\r\\n218632982\\r\\n688426143\\r\\n942792071\\r\\n398871317\\r\\n678294451\\r\\n807874326\\r\\n129579875\\r\\n419134701\\r\\n787610942\\r\\n139711567\\r\\n139711567\\r\\n368476241\\r\\n378607933\\r\\n139711567\\r\\n498056116\\r\\n848401094\\r\\n787610942\\r\\n698557835\\r\\n797742634\\r\\n967849277\\r\\n927322509\\r\\n957717585']}, {'input': '30 30\\r\\n0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 12 9 1 5 32 38 25 34 31 27 43 13 38 48 40 5 42 20 45 1 4 35 38 1 44 31 42 8 37\\r\\n', 'output': ['399967190\\r\\n806628868\\r\\n604971651\\r\\n399967190\\r\\n3347244\\r\\n800038448\\r\\n225087925\\r\\n16736220\\r\\n621707871\\r\\n420050654\\r\\n816670600\\r\\n228435169\\r\\n208351705\\r\\n225087925\\r\\n231782413\\r\\n26777952\\r\\n3347244\\r\\n51806110\\r\\n13388976\\r\\n30125196\\r\\n399967190\\r\\n601624407\\r\\n23430708\\r\\n225087925\\r\\n399967190\\r\\n628402359\\r\\n420050654\\r\\n826712332\\r\\n205004461\\r\\n823365088']}, {'input': '30 30\\r\\n0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1 1 1 1 0\\r\\n5 20 47 27 17 5 18 30 43 23 44 6 47 8 23 41 2 46 49 33 45 27 33 16 36 2 42 36 8 23\\r\\n', 'output': ['114252107\\r\\n760713694\\r\\n489959522\\r\\n18014766\\r\\n787754905\\r\\n689300600\\r\\n484993454\\r\\n142826188\\r\\n936763395\\r\\n126261951\\r\\n805769671\\r\\n827160720\\r\\n475023194\\r\\n781749983\\r\\n176049701\\r\\n138271795\\r\\n444998584\\r\\n252523902\\r\\n765679762\\r\\n354766165\\r\\n214239282\\r\\n727490181\\r\\n354766165\\r\\n565255613\\r\\n24019688\\r\\n275720240\\r\\n798903275\\r\\n969986908\\r\\n104636607\\r\\n126261951']}, {'input': '30 30\\r\\n0 0 0 0 0 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\\r\\n39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39\\r\\n', 'output': ['417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n142843895']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22\\r\\n', 'output': ['23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n2 1 1 2 2 1 2 1 1 2 2 2 1 2 2 1 1 1 2 1 2 1 2 2 2 1 2 1 1 2 2 2 2 2 1 2 2 2 2 2 2 1 2 1 2 2 2 1 1 2\\r\\n', 'output': ['714792256\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n71479...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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\\r\\n1 1 1 2 1 1 1 1 1 2 1 1 1 2 2 2 1 1 1 1 2 2 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 2 2 2 1\\r\\n', 'output': ['964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n824636640\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n93147...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0\\r\\n1 2 2 2 2 2 2 1 1 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 2 2 1 1 1 1 2 2 2 1 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 1\\r\\n', 'output': ['512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n96131098\\r\\n27359387\\r\\n27359387\\r\\n5128...']}, {'input': '50 50\\r\\n0 0 0 0 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 1\\r\\n2 1 1 1 1 2 2 2 1 1 2 2 2 1 2 1 2 2 2 1 1 1 1 2 2 1 1 1 1 2 1 2 2 2 2 1 1 1 2 1 2 1 1 2 2 1 1 2 2 1\\r\\n', 'output': ['303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n480354901\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n15198...']}, {'input': '50 50\\r\\n0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 0 0 0\\r\\n1 1 1 1 1 2 2 1 1 2 2 2 1 1 1 2 2 2 1 1 1 1 2 1 1 1 2 2 1 1 1 2 2 1 1 2 1 1 2 2 2 2 2 2 2 2 2 1 2 1\\r\\n', 'output': ['525100120\\r\\n525100120\\r\\n392384920\\r\\n525100120\\r\\n525100120\\r\\n51955887\\r\\n784769840\\r\\n525100120\\r\\n392384920\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n392384920\\r\\n392384920\\r\\n525100120\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n392384920\\r\\n392384920\\r\\n392384920\\r\\n392384920\\r\\n784769840\\r\\n392384920\\r\\n525100120\\r\\n392384920\\r\\n51955887\\r\\n784769840\\r\\n525100120\\r\\n392384920\\r\\n525100120\\r\\n51955887\\r\\n51955887\\r\\n525100120\\r\\n392384920\\r\\n784769840\\r\\n525100120\\r\\n525100120\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n51955887\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n784769840\\r\\n51955887\\r\\n5251...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n32 22 24 45 22 17 10 5 27 1 48 15 14 43 11 16 38 31 24 19 5 28 2 4 34 29 18 32 47 11 2 34 39 29 36 11 39 24 23 16 41 45 17 39 30 15 16 3 3 8\\r\\n', 'output': ['118672439\\r\\n268758118\\r\\n837687594\\r\\n821980974\\r\\n268758118\\r\\n842923134\\r\\n848158674\\r\\n424079337\\r\\n692837455\\r\\n284464738\\r\\n677130835\\r\\n273993658\\r\\n987773273\\r\\n253051498\\r\\n134379059\\r\\n558458396\\r\\n827216514\\r\\n832452054\\r\\n837687594\\r\\n413608257\\r\\n424079337\\r\\n977302193\\r\\n568929476\\r\\n139614599\\r\\n687601915\\r\\n263522578\\r\\n129143519\\r\\n118672439\\r\\n392666097\\r\\n134379059\\r\\n568929476\\r\\n687601915\\r\\n113436899\\r\\n263522578\\r\\n258287038\\r\\n134379059\\r\\n113436899\\r\\n837687594\\r\\n553222856\\r\\n558458396\\r\\n682366375\\r\\n821980974\\r\\n842923134\\r\\n113436899\\r\\n547987316\\r\\n273993658\\r\\n55845...']}, {'input': '50 50\\r\\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n49 34 4 15 32 20 22 35 3 28 15 46 4 46 16 11 45 42 11 4 15 36 29 10 27 32 1 1 23 11 6 34 35 19 11 5 2 37 9 20 39 33 27 4 21 33 6 23 37 50\\r\\n', 'output': ['41887747\\r\\n858571128\\r\\n101008368\\r\\n378781380\\r\\n808066944\\r\\n505041840\\r\\n555546024\\r\\n883823220\\r\\n75756276\\r\\n707058576\\r\\n378781380\\r\\n163351879\\r\\n101008368\\r\\n163351879\\r\\n404033472\\r\\n277773012\\r\\n138099787\\r\\n62343511\\r\\n277773012\\r\\n101008368\\r\\n378781380\\r\\n909075312\\r\\n732310668\\r\\n252520920\\r\\n681806484\\r\\n808066944\\r\\n25252092\\r\\n25252092\\r\\n580798116\\r\\n277773012\\r\\n151512552\\r\\n858571128\\r\\n883823220\\r\\n479789748\\r\\n277773012\\r\\n126260460\\r\\n50504184\\r\\n934327404\\r\\n227268828\\r\\n505041840\\r\\n984831588\\r\\n833319036\\r\\n681806484\\r\\n101008368\\r\\n530293932\\r\\n833319036\\r\\n151512552\\r\\n...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 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\\r\\n12 29 36 24 44 22 38 43 30 19 15 2 39 8 13 50 29 18 37 19 32 39 42 41 20 11 14 25 4 35 14 23 17 29 1 19 3 6 8 31 26 46 9 31 36 49 21 38 17 27\\r\\n', 'output': ['820896192\\r\\n985588111\\r\\n466199870\\r\\n643548031\\r\\n15219645\\r\\n506731999\\r\\n603015902\\r\\n945055982\\r\\n986069299\\r\\n301507951\\r\\n27875887\\r\\n136816032\\r\\n671423918\\r\\n547264128\\r\\n889304208\\r\\n425667741\\r\\n985588111\\r\\n233099935\\r\\n534607886\\r\\n301507951\\r\\n192567806\\r\\n671423918\\r\\n876647966\\r\\n808239950\\r\\n369915967\\r\\n752488176\\r\\n957712224\\r\\n711956047\\r\\n273632064\\r\\n397791854\\r\\n957712224\\r\\n575140015\\r\\n164691919\\r\\n985588111\\r\\n68408016\\r\\n301507951\\r\\n205224048\\r\\n410448096\\r\\n547264128\\r\\n124159790\\r\\n780364063\\r\\n152035677\\r\\n615672144\\r\\n124159790\\r\\n466199870\\r\\n357259725\\r\\n43832398...']}, {'input': '50 50\\r\\n0 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 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n25 31 26 45 2 6 25 14 35 23 31 16 24 36 44 8 18 41 36 3 27 21 15 44 45 45 25 8 3 43 7 25 48 45 44 33 25 49 8 46 14 12 12 46 45 43 29 40 1 47\\r\\n', 'output': ['26673909\\r\\n312584066\\r\\n906195896\\r\\n646959648\\r\\n760799621\\r\\n285910157\\r\\n26673909\\r\\n334375582\\r\\n835938955\\r\\n264118641\\r\\n312584066\\r\\n96930850\\r\\n145396275\\r\\n717216589\\r\\n765682014\\r\\n48465425\\r\\n857730471\\r\\n123604759\\r\\n717216589\\r\\n642077255\\r\\n787473530\\r\\n501563373\\r\\n215653216\\r\\n765682014\\r\\n646959648\\r\\n108381283\\r\\n26673909\\r\\n48465425\\r\\n642077255\\r\\n884404380\\r\\n167187791\\r\\n26673909\\r\\n290792550\\r\\n646959648\\r\\n765682014\\r\\n75139334\\r\\n614792020\\r\\n172070184\\r\\n48465425\\r\\n528237282\\r\\n334375582\\r\\n571820314\\r\\n571820314\\r\\n528237282\\r\\n646959648\\r\\n884404380\\r\\n550028798\\r\\n242...']}, {'input': '50 50\\r\\n0 0 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0\\r\\n45 49 17 22 28 34 24 38 5 46 22 36 11 12 43 21 47 39 38 38 38 27 10 49 19 46 23 7 46 35 11 38 25 16 7 32 12 13 44 14 41 36 7 31 4 46 40 28 28 46\\r\\n', 'output': ['644620779\\r\\n102973792\\r\\n443172276\\r\\n267699221\\r\\n201448503\\r\\n886344552\\r\\n745782947\\r\\n99391617\\r\\n196964962\\r\\n259647944\\r\\n267699221\\r\\n619552244\\r\\n632971787\\r\\n371547745\\r\\n416322096\\r\\n28657358\\r\\n254279678\\r\\n338433480\\r\\n344697565\\r\\n344697565\\r\\n99391617\\r\\n464664183\\r\\n143249062\\r\\n102973792\\r\\n548817985\\r\\n15237815\\r\\n129823972\\r\\n675048688\\r\\n259647944\\r\\n380510381\\r\\n756520580\\r\\n344697565\\r\\n984824810\\r\\n829936749\\r\\n675048688\\r\\n658045869\\r\\n371547745\\r\\n112811160\\r\\n535398442\\r\\n599846428\\r\\n188023413\\r\\n619552244\\r\\n299923214\\r\\n44774351\\r\\n956167452\\r\\n259647944\\r\\n577475343\\r...']}, {'input': '50 50\\r\\n0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47\\r\\n', 'output': ['529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n988406960\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n52947...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8\\r\\n', 'output': ['9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9']}, {'input': '5 50\\r\\n1 1 1 1 1\\r\\n1 1 4 2 3\\r\\n', 'output': ['635246412\\r\\n635246412\\r\\n544496942\\r\\n272248471\\r\\n907494883']}, {'input': '10 50\\r\\n0 0 0 0 0 0 0 0 1 0\\r\\n3 1 3 3 1 3 1 2 2 1\\r\\n', 'output': ['187134581\\r\\n727874429\\r\\n187134581\\r\\n187134581\\r\\n727874429\\r\\n187134581\\r\\n727874429\\r\\n457504505\\r\\n124563167\\r\\n727874429']}, {'input': '20 50\\r\\n1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1\\r\\n1 2 2 1 2 2 2 2 2 2 1 1 2 2 2 1 1 1 2 2\\r\\n', 'output': ['853605709\\r\\n708967065\\r\\n708967065\\r\\n853605709\\r\\n708967065\\r\\n708967065\\r\\n708967065\\r\\n922030188\\r\\n708967065\\r\\n922030188\\r\\n853605709\\r\\n853605709\\r\\n708967065\\r\\n922030188\\r\\n708967065\\r\\n461015094\\r\\n853605709\\r\\n853605709\\r\\n708967065\\r\\n708967065']}, {'input': '20 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 2 2 2 2 2 2 1 2 1 2 1 2 1 1 2 1 2 2 1\\r\\n', 'output': ['436731907\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n873463814\\r\\n436731907']}, {'input': '40 50\\r\\n0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0\\r\\n33 26 4 19 42 43 19 32 13 23 19 1 18 43 43 43 19 31 4 25 28 23 33 37 36 23 5 12 18 32 34 1 21 22 34 35 37 16 41 39\\r\\n', 'output': ['729284231\\r\\n60340485\\r\\n239647233\\r\\n389641092\\r\\n20685064\\r\\n829280137\\r\\n389641092\\r\\n918933511\\r\\n529292419\\r\\n629288325\\r\\n366487398\\r\\n808595073\\r\\n579290372\\r\\n829280137\\r\\n829280137\\r\\n41331201\\r\\n389641092\\r\\n110338438\\r\\n239647233\\r\\n249989765\\r\\n679286278\\r\\n629288325\\r\\n426374038\\r\\n968931464\\r\\n160336391\\r\\n629288325\\r\\n49997953\\r\\n718941699\\r\\n579290372\\r\\n918933511\\r\\n539634951\\r\\n808595073\\r\\n89829960\\r\\n818937605\\r\\n539634951\\r\\n349985671\\r\\n968931464\\r\\n958588932\\r\\n210334344\\r\\n589632904']}, {'input': '41 50\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 2 4 2 3 2 4 3 1 1 3 1 3 2 5 3 3 5 4 4 1 1 2 3 2 1 5 5 5 4 2 2 2 1 2 4 4 5 2 1 4\\r\\n', 'output': ['394710173\\r\\n789420346\\r\\n580596339\\r\\n789420346\\r\\n185886166\\r\\n789420346\\r\\n580596339\\r\\n185886166\\r\\n394710173\\r\\n394710173\\r\\n185886166\\r\\n394710173\\r\\n581788048\\r\\n789420346\\r\\n636898629\\r\\n185886166\\r\\n185886166\\r\\n975306512\\r\\n580596339\\r\\n580596339\\r\\n394710173\\r\\n394710173\\r\\n55110581\\r\\n185886166\\r\\n55110581\\r\\n394710173\\r\\n975306512\\r\\n975306512\\r\\n975306512\\r\\n580596339\\r\\n789420346\\r\\n789420346\\r\\n789420346\\r\\n394710173\\r\\n789420346\\r\\n580596339\\r\\n580596339\\r\\n975306512\\r\\n789420346\\r\\n394710173\\r\\n580596339']}, {'input': '42 50\\r\\n0 1 0 0 0 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 1 0 0 0 0 0 0 0 1 0 0 0\\r\\n2 4 6 8 1 3 6 1 4 1 3 4 3 7 6 6 8 7 4 1 7 4 6 9 3 1 9 7 1 2 9 3 1 6 1 5 1 8 2 6 8 8\\r\\n', 'output': ['11284873\\r\\n329090227\\r\\n33854619\\r\\n45139492\\r\\n504764613\\r\\n995500935\\r\\n33854619\\r\\n504764613\\r\\n22569746\\r\\n504764613\\r\\n516049486\\r\\n22569746\\r\\n516049486\\r\\n538619232\\r\\n33854619\\r\\n33854619\\r\\n45139492\\r\\n538619232\\r\\n22569746\\r\\n504764613\\r\\n538619232\\r\\n22569746\\r\\n33854619\\r\\n549904105\\r\\n516049486\\r\\n504764613\\r\\n549904105\\r\\n538619232\\r\\n504764613\\r\\n11284873\\r\\n990014099\\r\\n516049486\\r\\n504764613\\r\\n33854619\\r\\n504764613\\r\\n527334359\\r\\n504764613\\r\\n45139492\\r\\n663667290\\r\\n33854619\\r\\n45139492\\r\\n45139492']}, {'input': '43 50\\r\\n1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n13 7 13 15 8 9 11 1 15 9 3 7 3 15 4 7 7 16 9 13 12 16 16 1 5 5 14 5 17 2 1 13 4 13 10 17 17 6 11 15 14 3 6\\r\\n', 'output': ['175780254\\r\\n94650906\\r\\n163530008\\r\\n802992688\\r\\n561362014\\r\\n881093354\\r\\n522311681\\r\\n319731340\\r\\n802992688\\r\\n881093354\\r\\n959194020\\r\\n241630674\\r\\n959194020\\r\\n802992688\\r\\n280681007\\r\\n241630674\\r\\n241630674\\r\\n124479675\\r\\n881093354\\r\\n163530008\\r\\n842043021\\r\\n124479675\\r\\n124479675\\r\\n13521558\\r\\n600412347\\r\\n600412347\\r\\n483261348\\r\\n67607790\\r\\n444211015\\r\\n639462680\\r\\n319731340\\r\\n163530008\\r\\n280681007\\r\\n163530008\\r\\n202580341\\r\\n444211015\\r\\n444211015\\r\\n920143687\\r\\n522311681\\r\\n802992688\\r\\n483261348\\r\\n959194020\\r\\n920143687']}, {'input': '44 50\\r\\n0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0\\r\\n2 6 6 11 2 4 11 10 5 15 15 20 20 7 9 8 17 4 16 19 12 16 12 13 2 11 20 2 6 10 2 18 7 5 18 10 15 6 11 9 7 5 17 11\\r\\n', 'output': ['327775237\\r\\n983325711\\r\\n983325711\\r\\n305397274\\r\\n327775237\\r\\n853173373\\r\\n305397274\\r\\n640631832\\r\\n320315916\\r\\n960947748\\r\\n960947748\\r\\n272889453\\r\\n283019311\\r\\n648091153\\r\\n975866390\\r\\n312856595\\r\\n290478632\\r\\n655550474\\r\\n625713190\\r\\n618253869\\r\\n968407069\\r\\n625713190\\r\\n968407069\\r\\n633172511\\r\\n327775237\\r\\n305397274\\r\\n283019311\\r\\n327775237\\r\\n983325711\\r\\n640631832\\r\\n327775237\\r\\n953488427\\r\\n648091153\\r\\n816905628\\r\\n953488427\\r\\n640631832\\r\\n960947748\\r\\n983325711\\r\\n305397274\\r\\n975866390\\r\\n648091153\\r\\n320315916\\r\\n290478632\\r\\n305397274']}, {'input': '45 50\\r\\n0 1 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 0\\r\\n4 4 23 23 13 23 9 16 4 18 20 15 21 24 22 20 22 1 15 7 10 17 20 6 15 7 4 10 16 7 14 9 13 17 10 14 22 23 3 5 20 11 4 24 24\\r\\n', 'output': ['630266647\\r\\n555616275\\r\\n379739073\\r\\n948743787\\r\\n301438985\\r\\n948743787\\r\\n669416691\\r\\n225976394\\r\\n555616275\\r\\n340589029\\r\\n156600176\\r\\n835755590\\r\\n563727926\\r\\n786866823\\r\\n560278630\\r\\n781592669\\r\\n970855676\\r\\n388465157\\r\\n835755590\\r\\n853405544\\r\\n889918511\\r\\n614441551\\r\\n156600176\\r\\n446277794\\r\\n117450132\\r\\n853405544\\r\\n630266647\\r\\n78300088\\r\\n225976394\\r\\n722767393\\r\\n708566735\\r\\n669416691\\r\\n58825276\\r\\n931705632\\r\\n78300088\\r\\n708566735\\r\\n970855676\\r\\n948743787\\r\\n223138897\\r\\n39150044\\r\\n781592669\\r\\n280139315\\r\\n555616275\\r\\n338964591\\r\\n786866823']}, {'input': '46 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n29 22 30 33 13 31 19 11 12 21 5 4 24 21 20 6 28 16 27 18 21 11 3 24 21 8 8 33 24 7 34 12 13 32 26 33 33 22 18 2 3 7 24 17 9 30\\r\\n', 'output': ['265429165\\r\\n98093399\\r\\n859759619\\r\\n646262275\\r\\n738585431\\r\\n455845720\\r\\n311590743\\r\\n548168876\\r\\n144254977\\r\\n502007298\\r\\n975163564\\r\\n380833110\\r\\n288509954\\r\\n502007298\\r\\n905921197\\r\\n571249665\\r\\n669343064\\r\\n525088087\\r\\n75012610\\r\\n715504642\\r\\n502007298\\r\\n548168876\\r\\n784747009\\r\\n288509954\\r\\n502007298\\r\\n761666220\\r\\n761666220\\r\\n646262275\\r\\n288509954\\r\\n167335766\\r\\n242348376\\r\\n144254977\\r\\n738585431\\r\\n51931821\\r\\n478926509\\r\\n646262275\\r\\n646262275\\r\\n98093399\\r\\n715504642\\r\\n190416555\\r\\n784747009\\r\\n167335766\\r\\n288509954\\r\\n121174188\\r\\n357752321\\r\\n859759619']}, {'input': '47 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n30 32 21 7 15 4 39 36 23 17 13 4 8 18 38 24 13 27 37 27 32 16 8 12 7 23 28 38 11 36 19 33 10 34 4 8 5 22 3 29 21 30 7 32 35 26 23\\r\\n', 'output': ['243227082\\r\\n658739962\\r\\n369907828\\r\\n456050727\\r\\n121613541\\r\\n831025760\\r\\n116546336\\r\\n491521369\\r\\n785420708\\r\\n537126421\\r\\n704345014\\r\\n831025760\\r\\n663807167\\r\\n744882861\\r\\n907034249\\r\\n993177148\\r\\n704345014\\r\\n618202115\\r\\n699277809\\r\\n618202115\\r\\n658739962\\r\\n329369981\\r\\n663807167\\r\\n496588574\\r\\n456050727\\r\\n785420708\\r\\n825958555\\r\\n907034249\\r\\n288832134\\r\\n491521369\\r\\n952639301\\r\\n866496402\\r\\n81075694\\r\\n76008489\\r\\n831025760\\r\\n663807167\\r\\n40537847\\r\\n577664268\\r\\n623269320\\r\\n35470642\\r\\n369907828\\r\\n243227082\\r\\n456050727\\r\\n658739962\\r\\n283764929\\r\\n410445675\\r\\n785420708...']}, {'input': '48 50\\r\\n1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 1\\r\\n9 42 15 12 2 9 41 13 23 14 17 42 25 10 10 2 38 36 41 31 9 20 31 41 20 41 40 28 7 37 14 25 23 38 27 17 6 40 2 19 19 3 8 32 13 22 41 20\\r\\n', 'output': ['386033769\\r\\n373559702\\r\\n643389615\\r\\n677156688\\r\\n85785282\\r\\n507867516\\r\\n317129978\\r\\n557604333\\r\\n299639299\\r\\n790016136\\r\\n959305308\\r\\n803246569\\r\\n74071672\\r\\n564297240\\r\\n564297240\\r\\n112859448\\r\\n631676005\\r\\n34981358\\r\\n760353928\\r\\n751077091\\r\\n386033769\\r\\n130350127\\r\\n751077091\\r\\n760353928\\r\\n130350127\\r\\n760353928\\r\\n717461287\\r\\n581787919\\r\\n395008068\\r\\n91411082\\r\\n790016136\\r\\n412498747\\r\\n299639299\\r\\n631676005\\r\\n159856954\\r\\n959305308\\r\\n338578344\\r\\n717461287\\r\\n112859448\\r\\n814960179\\r\\n73920403\\r\\n169289172\\r\\n451437792\\r\\n807506815\\r\\n733586412\\r\\n243209575\\r\\n317129978\\r...']}, {'input': '49 50\\r\\n0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0\\r\\n2 3 2 3 4 2 1 1 1 1 1 1 3 1 2 3 2 4 1 2 2 1 1 2 4 3 2 4 1 2 1 1 2 3 1 3 3 2 2 1 4 3 4 1 3 3 4 1 3\\r\\n', 'output': ['136570933\\r\\n703978576\\r\\n136570933\\r\\n703978576\\r\\n273141866\\r\\n136570933\\r\\n567407643\\r\\n478951804\\r\\n567407643\\r\\n567407643\\r\\n478951804\\r\\n478951804\\r\\n703978576\\r\\n567407643\\r\\n136570933\\r\\n703978576\\r\\n136570933\\r\\n273141866\\r\\n567407643\\r\\n136570933\\r\\n136570933\\r\\n567407643\\r\\n567407643\\r\\n136570933\\r\\n273141866\\r\\n703978576\\r\\n957903608\\r\\n273141866\\r\\n567407643\\r\\n136570933\\r\\n567407643\\r\\n567407643\\r\\n136570933\\r\\n703978576\\r\\n567407643\\r\\n438611059\\r\\n438611059\\r\\n136570933\\r\\n136570933\\r\\n478951804\\r\\n273141866\\r\\n703978576\\r\\n917562863\\r\\n478951804\\r\\n703978576\\r\\n703978576\\r\\n27314...']}, {'input': '50 50\\r\\n0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1\\r\\n1 9 24 8 8 11 21 11 8 5 16 32 31 15 29 14 16 20 5 18 5 10 31 23 21 4 4 20 20 11 1 4 4 15 9 14 5 30 13 16 32 27 19 10 19 24 21 1 21 15\\r\\n', 'output': ['475420905\\r\\n285810733\\r\\n429413837\\r\\n935878068\\r\\n808634181\\r\\n787710167\\r\\n1395475\\r\\n787710167\\r\\n808634181\\r\\n85801616\\r\\n619024009\\r\\n748779213\\r\\n762627113\\r\\n143603104\\r\\n896947114\\r\\n666426552\\r\\n619024009\\r\\n343206464\\r\\n380615819\\r\\n571621466\\r\\n380615819\\r\\n171603232\\r\\n132672278\\r\\n952237285\\r\\n1395475\\r\\n467939034\\r\\n467939034\\r\\n524218923\\r\\n343206464\\r\\n238408190\\r\\n616106935\\r\\n467939034\\r\\n467939034\\r\\n143603104\\r\\n285810733\\r\\n639542266\\r\\n85801616\\r\\n514809696\\r\\n23435331\\r\\n619024009\\r\\n748779213\\r\\n662977597\\r\\n725343882\\r\\n761231638\\r\\n48798018\\r\\n429413837\\r\\n959313399\\r\\n61...']}, {'input': '47 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39\\r\\n', 'output': ['573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n57345...']}, {'input': '48 50\\r\\n1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 1\\r\\n42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42\\r\\n', 'output': ['612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n27123...']}, {'input': '49 50\\r\\n0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0\\r\\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\\r\\n', 'output': ['371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n37100...']}, {'input': '50 50\\r\\n0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1\\r\\n33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33\\r\\n', 'output': ['677141055\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141055\\r\\n67714...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n982795629\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n83495...']}, {'input': '50 50\\r\\n1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n99630...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n70582...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 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\\r\\n25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25\\r\\n', 'output': ['382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n798399400\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n38299...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 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\\r\\n25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25\\r\\n', 'output': ['459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n533798960\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n45908...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 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\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n273616393\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n31116...']}, {'input': '50 50\\r\\n0 0 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['123180764\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n12318...']}, {'input': '50 50\\r\\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['80661140\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51']}, {'input': '5 5\\r\\n0 1 0 0 1\\r\\n2 4 1 2 1\\r\\n', 'output': ['665717847\\r\\n333191345\\r\\n831981100\\r\\n665717847\\r\\n831981101']}, {'input': '20 20\\r\\n0 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 1 1 1 0\\r\\n109 1 24 122 136 42 25 112 110 15 26 48 35 10 86 13 41 6 24 15\\r\\n', 'output': ['217595927\\r\\n149660176\\r\\n322657182\\r\\n290143118\\r\\n388896876\\r\\n296261274\\r\\n86540143\\r\\n507489163\\r\\n979723241\\r\\n248413934\\r\\n896431517\\r\\n195977977\\r\\n246884395\\r\\n633562669\\r\\n891842900\\r\\n947337935\\r\\n146601098\\r\\n897961056\\r\\n597111165\\r\\n451221827']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n2360379 9167688 488710 6896065 5243867 11762954 673012 1669264 265550 10921726 9383074 9523863 13429215 3223202 5372988 8197773 13052301 6045370 18630475 23534272 14923100 17181531 1112172 24623774 16991041 2363652 10720874 7171147 1261895 13127315 454592 1510882 12229327 15445105 15722482 5467131 92...', 'output': ['19790585\\r\\n929149870\\r\\n158142558\\r\\n415179791\\r\\n770973301\\r\\n197788614\\r\\n662208363\\r\\n968610058\\r\\n711622366\\r\\n89060603\\r\\n49510939\\r\\n593110743\\r\\n227455934\\r\\n197704062\\r\\n89005665\\r\\n237287745\\r\\n266986632\\r\\n365753331\\r\\n365877936\\r\\n464762563\\r\\n879788817\\r\\n148424226\\r\\n355820880\\r\\n830466826\\r\\n583301068\\r\\n553505420\\r\\n59407792\\r\\n988431747\\r\\n889537165\\r\\n425125094\\r\\n978481639\\r\\n494195332\\r\\n98957157\\r\\n850143163\\r\\n474568826\\r\\n889578801\\r\\n691943729\\r\\n751249179\\r\\n29723781\\r\\n385464681\\r\\n494219413\\r\\n968727719\\r\\n622687463\\r\\n929103141\\r\\n89090024\\r\\n563393484\\r\\n29714966\\r\\n484...']}, {'input': '1000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['652684471\\r\\n652684471\\r\\n959809060\\r\\n652684471\\r\\n307124589\\r\\n652684471\\r\\n652684471\\r\\n614249178\\r\\n307124589\\r\\n307124589\\r\\n307124589\\r\\n959809060\\r\\n652684471\\r\\n652684471\\r\\n959809060\\r\\n307124589\\r\\n307124589\\r\\n614249178\\r\\n652684471\\r\\n307124589\\r\\n652684471\\r\\n307124589\\r\\n307124589\\r\\n652684471\\r\\n268689296\\r\\n307124589\\r\\n959809060\\r\\n652684471\\r\\n307124589\\r\\n652684471\\r\\n614249178\\r\\n959809060\\r\\n652684471\\r\\n652684471\\r\\n307124589\\r\\n614249178\\r\\n307124589\\r\\n652684471\\r\\n652684471\\r\\n959809060\\r\\n307124589\\r\\n959809060\\r\\n307124589\\r\\n307124589\\r\\n959809060\\r\\n307124589\\r\\n95980...']}, {'input': '50000 1000\\r\\n1 0 0 1 0 0 0 1 1 1 0 1 0 1 1 0 1 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 1 0 0 0 1 1 0 1 0 0 1 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0...', 'output': ['512182090\\r\\n641172382\\r\\n697325018\\r\\n818311552\\r\\n590906119\\r\\n461103680\\r\\n370418391\\r\\n653972733\\r\\n766040380\\r\\n237657896\\r\\n893425807\\r\\n807372188\\r\\n964959592\\r\\n319396135\\r\\n111079234\\r\\n137994713\\r\\n9663504\\r\\n92358638\\r\\n965938119\\r\\n98687680\\r\\n675026792\\r\\n279244742\\r\\n15543727\\r\\n479206408\\r\\n519670811\\r\\n684652624\\r\\n777078382\\r\\n554151828\\r\\n865485075\\r\\n937290032\\r\\n565154228\\r\\n221807985\\r\\n218937300\\r\\n112386612\\r\\n310142313\\r\\n986922988\\r\\n267227503\\r\\n40988675\\r\\n369434552\\r\\n763776107\\r\\n694666611\\r\\n182771968\\r\\n494768207\\r\\n633944759\\r\\n635638470\\r\\n761724538\\r\\n162219074\\r\\n...']}, {'input': '200000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['967977965\\r\\n983111159\\r\\n952844771\\r\\n937711577\\r\\n937711577\\r\\n771246443\\r\\n483715757\\r\\n892311995\\r\\n967977965\\r\\n801512831\\r\\n846912413\\r\\n831779219\\r\\n967977965\\r\\n786379637\\r\\n892311995\\r\\n604781309\\r\\n710713667\\r\\n952844771\\r\\n952844771\\r\\n937711577\\r\\n874943312\\r\\n120519101\\r\\n892311995\\r\\n589648115\\r\\n619914503\\r\\n665314085\\r\\n374637533\\r\\n892311995\\r\\n937711577\\r\\n892311995\\r\\n650180891\\r\\n771246443\\r\\n922578383\\r\\n877178801\\r\\n483715757\\r\\n892311995\\r\\n952844771\\r\\n619914503\\r\\n574514921\\r\\n62834123\\r\\n907445189\\r\\n816646025\\r\\n846912413\\r\\n816646025\\r\\n937711577\\r\\n756113249\\r\\n846912...']}, {'input': '200000 3000\\r\\n0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 ...', 'output': ['568390992\\r\\n182388528\\r\\n352385861\\r\\n315979953\\r\\n743372559\\r\\n632628120\\r\\n995395434\\r\\n506334569\\r\\n667771666\\r\\n453192833\\r\\n680429762\\r\\n407446046\\r\\n471154985\\r\\n147648615\\r\\n936047905\\r\\n830053040\\r\\n251214636\\r\\n602162072\\r\\n263562703\\r\\n990790012\\r\\n150217484\\r\\n82075059\\r\\n932318671\\r\\n687474214\\r\\n345881774\\r\\n771937952\\r\\n356541287\\r\\n15233024\\r\\n811478946\\r\\n737405100\\r\\n892805310\\r\\n176354033\\r\\n997083988\\r\\n281716722\\r\\n628262667\\r\\n556117647\\r\\n359954433\\r\\n926451677\\r\\n992018326\\r\\n134736321\\r\\n139309832\\r\\n510415929\\r\\n125029199\\r\\n222157092\\r\\n859462710\\r\\n16077301\\r\\n83159806...']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 1 3 2 1 3 2 1 1 2 1 1 2 2 4 2 1 5 2 3\\r\\n', 'output': ['249561090\\r\\n249561090\\r\\n748683270\\r\\n499122180\\r\\n249561090\\r\\n748683270\\r\\n499122180\\r\\n249561090\\r\\n249561090\\r\\n499122180\\r\\n249561090\\r\\n249561090\\r\\n499122180\\r\\n499122180\\r\\n7\\r\\n499122180\\r\\n249561090\\r\\n249561097\\r\\n499122180\\r\\n748683270']}, {'input': '20 30\\r\\n1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 2 1 3 1 4 1 5 1 1 2 3 1 1 3 3 2 2 1 2\\r\\n', 'output': ['902255482\\r\\n806266611\\r\\n902255482\\r\\n710277740\\r\\n902255482\\r\\n537377994\\r\\n902255482\\r\\n518299998\\r\\n902255482\\r\\n902255482\\r\\n806266611\\r\\n710277740\\r\\n902255482\\r\\n902255482\\r\\n710277740\\r\\n710277740\\r\\n806266611\\r\\n806266611\\r\\n902255482\\r\\n806266611']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0\\r\\n3 4 1 2 1 1 1 2 5 2 1 2 3 1 1 2 3 2 1 2\\r\\n', 'output': ['441078046\\r\\n920852179\\r\\n479774133\\r\\n959548266\\r\\n479774133\\r\\n479774133\\r\\n479774133\\r\\n959548266\\r\\n402381959\\r\\n263018694\\r\\n479774133\\r\\n959548266\\r\\n441078046\\r\\n479774133\\r\\n479774133\\r\\n959548266\\r\\n441078046\\r\\n959548266\\r\\n479774133\\r\\n959548266']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0\\r\\n1 1 3 2 3 1 2 2 3 2 2 2 2 2 2 3 3 1 1 2\\r\\n', 'output': ['550803098\\r\\n550803098\\r\\n654164941\\r\\n103361843\\r\\n654164941\\r\\n550803098\\r\\n103361843\\r\\n103361843\\r\\n654164941\\r\\n103361843\\r\\n103361843\\r\\n103361843\\r\\n103361843\\r\\n103361843\\r\\n276551708\\r\\n654164941\\r\\n654164941\\r\\n138275854\\r\\n550803098\\r\\n103361843']}, {'input': '20 30\\r\\n0 0 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1\\r\\n1 2 2 2 2 2 1 1 2 1 4 1 2 5 3 4 1 1 2 1\\r\\n', 'output': ['297511613\\r\\n595023226\\r\\n756311680\\r\\n756311680\\r\\n756311680\\r\\n595023226\\r\\n297511613\\r\\n378155840\\r\\n595023226\\r\\n297511613\\r\\n514379007\\r\\n297511613\\r\\n595023226\\r\\n892534847\\r\\n136223167\\r\\n514379007\\r\\n378155840\\r\\n297511613\\r\\n595023226\\r\\n378155840']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n765 451 7275 385 1686 78 554 114 1980 394 776 232 627 760 782 7 486 32 1100 1516\\r\\n', 'output': ['491636110\\r\\n498623506\\r\\n486651408\\r\\n182179980\\r\\n6989399\\r\\n10980766\\r\\n871467875\\r\\n92836839\\r\\n509106603\\r\\n951327263\\r\\n211628580\\r\\n83852758\\r\\n11480438\\r\\n618912260\\r\\n58897200\\r\\n820057743\\r\\n605934809\\r\\n183676993\\r\\n948333237\\r\\n341401087']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1\\r\\n779 1317 1275 234 857 1531 785 265 679 767 1994 11 918 1146 1807 71 813 245 3926 580\\r\\n', 'output': ['552990868\\r\\n90431251\\r\\n712871250\\r\\n952916426\\r\\n537881559\\r\\n151361542\\r\\n321464532\\r\\n89445141\\r\\n86037605\\r\\n17799187\\r\\n586392419\\r\\n241031286\\r\\n40642277\\r\\n699465709\\r\\n481837969\\r\\n920500985\\r\\n572000768\\r\\n195703359\\r\\n903238702\\r\\n911489090']}, {'input': '20 30\\r\\n0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n128 574 205 490 611 1294 283 1690 1466 1896 272 19 1020 5032 357 1500 36 1749 1202 176\\r\\n', 'output': ['389864218\\r\\n157345415\\r\\n537589523\\r\\n962131647\\r\\n753565149\\r\\n104281847\\r\\n378440811\\r\\n873692367\\r\\n690552162\\r\\n658861420\\r\\n578900375\\r\\n198248582\\r\\n923070965\\r\\n228091231\\r\\n572635926\\r\\n887695253\\r\\n795942304\\r\\n70748620\\r\\n510359933\\r\\n785624388']}, {'input': '20 30\\r\\n1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0\\r\\n61 849 320 1007 624 441 1332 3939 1176 718 419 634 657 914 858 882 1019 1567 62 2521\\r\\n', 'output': ['514012356\\r\\n393871659\\r\\n166092575\\r\\n569465276\\r\\n74319433\\r\\n306884170\\r\\n254628439\\r\\n656312237\\r\\n485609669\\r\\n216694535\\r\\n825782618\\r\\n110704962\\r\\n294216114\\r\\n131255421\\r\\n733108087\\r\\n613768340\\r\\n14181299\\r\\n610566194\\r\\n624888021\\r\\n887363731']}, {'input': '20 30\\r\\n0 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 0 0\\r\\n244 1901 938 1350 1010 763 318 2158 1645 534 1356 563 295 1449 2306 224 1302 195 639 810\\r\\n', 'output': ['300071414\\r\\n595185476\\r\\n40756239\\r\\n113904636\\r\\n440148868\\r\\n947268885\\r\\n456535325\\r\\n542868956\\r\\n183161324\\r\\n427608407\\r\\n61171180\\r\\n375813928\\r\\n43680359\\r\\n55509680\\r\\n30410255\\r\\n360521133\\r\\n535772284\\r\\n722568686\\r\\n663107799\\r\\n390646234']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n126679203 179924771 16639504 67055540 14134870 36407782 15024189 39367944 121531542 5400023 5834434 8539193 3686913 11287136 36370086 71808281 138206490 59846864 19052959 21446598\\r\\n', 'output': ['615913610\\r\\n488825486\\r\\n773371096\\r\\n742795989\\r\\n193664548\\r\\n323188752\\r\\n32686082\\r\\n709701410\\r\\n293733249\\r\\n161181348\\r\\n193396792\\r\\n354491196\\r\\n708550409\\r\\n644392716\\r\\n323187536\\r\\n646345011\\r\\n487479735\\r\\n1930544\\r\\n322628919\\r\\n966734748']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1\\r\\n144831196 28660251 62050800 52660762 23189000 12771861 73096012 25119113 119648684 16011144 51600638 74708999 6312006 26945863 68746869 58112898 5070 19157938 74351320 60263898\\r\\n', 'output': ['132556548\\r\\n711988928\\r\\n6999755\\r\\n208709864\\r\\n320161276\\r\\n865416376\\r\\n320896979\\r\\n458941660\\r\\n671806481\\r\\n158009043\\r\\n351362956\\r\\n78248147\\r\\n927871852\\r\\n882014191\\r\\n988190329\\r\\n830735503\\r\\n1958329\\r\\n787106839\\r\\n942059547\\r\\n341315444']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0\\r\\n34095514 37349809 60555988 40280455 19504485 77297461 41415742 66290058 20631093 185280391 7151718 64927972 15611855 4317891 24600598 24588269 60808977 9108470 13217752 191209824\\r\\n', 'output': ['313283482\\r\\n21804622\\r\\n682197550\\r\\n361027027\\r\\n756362680\\r\\n151917509\\r\\n716108102\\r\\n131732975\\r\\n237068086\\r\\n731869119\\r\\n190595295\\r\\n847684643\\r\\n847454143\\r\\n501579235\\r\\n129856516\\r\\n246699402\\r\\n205385635\\r\\n639100445\\r\\n614421017\\r\\n227076269']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0\\r\\n9380933 34450681 12329733 7732927 73910078 16165679 149467043 56914401 21809098 36934833 71019254 168559440 12033996 40465391 7156881 3312348 37150678 130625432 42709585 66115911\\r\\n', 'output': ['813231583\\r\\n458087744\\r\\n445793615\\r\\n651101155\\r\\n484645642\\r\\n506668954\\r\\n896602699\\r\\n556862659\\r\\n145127201\\r\\n302005399\\r\\n558418033\\r\\n213871822\\r\\n57299634\\r\\n564466143\\r\\n767349204\\r\\n290138481\\r\\n12657688\\r\\n925337836\\r\\n827843024\\r\\n119362169']}, {'input': '20 30\\r\\n0 0 1 0 1 0 1 1 1 0 1 1 0 0 1 0 0 1 0 1\\r\\n66166717 200301718 6725634 95379617 42880832 48874211 64912554 36809296 13248978 58406666 53142218 45080678 19902257 58554006 23570140 14484661 7589423 78746789 11072716 52395211\\r\\n', 'output': ['823107880\\r\\n742699237\\r\\n987770596\\r\\n549924308\\r\\n730188349\\r\\n913535291\\r\\n936423447\\r\\n122869154\\r\\n581668441\\r\\n749452306\\r\\n615454312\\r\\n176148736\\r\\n874336841\\r\\n897418997\\r\\n235568492\\r\\n24727530\\r\\n143875067\\r\\n15270097\\r\\n200154604\\r\\n356406452']}, {'input': '20 30\\r\\n0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661\\r\\n', 'output': ['76898501\\r\\n989279651\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803\\r\\n', 'output': ['504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981']}, {'input': '2000 300\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...', 'output': ['527557309\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n819771096\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n762900831\\r\\n762900831\\r\\n292213787\\r\\n762900831\\r\\n527557309\\r\\n292213787\\r\\n762900831\\r\\n292213787\\r\\n527557309\\r\\n762900831\\r\\n292213787\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n819771096\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n292213787\\r\\n762900831\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n762900831\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n76290...', '126026410\\r\\n26532090\\r\\n89545496\\r\\n348227668\\r\\n407921745\\r\\n822476105\\r\\n815841057\\r\\n129343473\\r\\n683184486\\r\\n182403525\\r\\n971714643\\r\\n669922973\\r\\n195669656\\r\\n643389211\\r\\n596958847\\r\\n991612114\\r\\n26531426\\r\\n494147799\\r\\n587007825\\r\\n646703323\\r\\n192353616\\r\\n198987665\\r\\n116075186\\r\\n208935334\\r\\n451035127\\r\\n991612774\\r\\n630129722\\r\\n673238446\\r\\n965081504\\r\\n404604334\\r\\n762781111\\r\\n945182265\\r\\n613540647\\r\\n855640163\\r\\n540577710\\r\\n739563385\\r\\n185720640\\r\\n13265829\\r\\n460984258\\r\\n182404969\\r\\n988297561\\r\\n726301539\\r\\n301795019\\r\\n46434122\\r\\n882170987\\r\\n533948601\\r\\n729615799\\r...', '257947573\\r\\n350833899\\r\\n998147431\\r\\n282054341\\r\\n689337877\\r\\n802790225\\r\\n636332064\\r\\n611526839\\r\\n405886622\\r\\n295781176\\r\\n577883978\\r\\n211877869\\r\\n476761551\\r\\n471920813\\r\\n313000296\\r\\n8886097\\r\\n165109708\\r\\n231143899\\r\\n91489412\\r\\n972042214\\r\\n584771626\\r\\n771892731\\r\\n841370746\\r\\n736106038\\r\\n702414716\\r\\n368751476\\r\\n510452873\\r\\n253155296\\r\\n619859862\\r\\n14376831\\r\\n37833603\\r\\n94933236\\r\\n485696109\\r\\n96233228\\r\\n33691322\\r\\n403791251\\r\\n233190809\\r\\n447164049\\r\\n173248887\\r\\n549683390\\r\\n863382143\\r\\n717538465\\r\\n704413165\\r\\n210480955\\r\\n414122723\\r\\n922528686\\r\\n131321464\\r\\n40...', '723727157\\r\\n723727157\\r\\n898419922\\r\\n449209961\\r\\n898419922\\r\\n174692765\\r\\n723727157\\r\\n723727157\\r\\n723727157\\r\\n449209961\\r\\n449209961\\r\\n174692765\\r\\n723727157\\r\\n174692765\\r\\n723727157\\r\\n723727157\\r\\n623902726\\r\\n723727157\\r\\n723727157\\r\\n449209961\\r\\n723727157\\r\\n449209961\\r\\n449209961\\r\\n174692765\\r\\n723727157\\r\\n449209961\\r\\n349385530\\r\\n449209961\\r\\n449209961\\r\\n449209961\\r\\n449209961\\r\\n723727157\\r\\n449209961\\r\\n449209961\\r\\n449209961\\r\\n623902726\\r\\n449209961\\r\\n449209961\\r\\n898419922\\r\\n898419922\\r\\n723727157\\r\\n449209961\\r\\n723727157\\r\\n723727157\\r\\n723727157\\r\\n174692765\\r\\n17469...', '449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n44954...', '228892698\\r\\n323233274\\r\\n31331450\\r\\n583630535\\r\\n530020844\\r\\n200867506\\r\\n762566026\\r\\n461091654\\r\\n900597519\\r\\n687197433\\r\\n232025843\\r\\n294169404\\r\\n557699810\\r\\n988325579\\r\\n966739790\\r\\n633933968\\r\\n156657250\\r\\n762046687\\r\\n338898999\\r\\n134379009\\r\\n458304735\\r\\n975792999\\r\\n343970609\\r\\n589896825\\r\\n188161813\\r\\n733675269\\r\\n708610109\\r\\n303222613\\r\\n919742615\\r\\n718701996\\r\\n235158988\\r\\n5746951\\r\\n831841442\\r\\n194601216\\r\\n389029319\\r\\n946729129\\r\\n65449819\\r\\n768486090\\r\\n213226973\\r\\n847160941\\r\\n853773457\\r\\n913476325\\r\\n847334054\\r\\n435334042\\r\\n997551901\\r\\n781018670\\r\\n847334054...', '280562572\\r\\n27981324\\r\\n930424996\\r\\n580126064\\r\\n653672085\\r\\n638998124\\r\\n192370181\\r\\n304975360\\r\\n268606553\\r\\n887998181\\r\\n902057157\\r\\n419880164\\r\\n965999027\\r\\n37849969\\r\\n655704617\\r\\n915939588\\r\\n290316653\\r\\n133632797\\r\\n916310849\\r\\n291352554\\r\\n315435621\\r\\n753760137\\r\\n617080324\\r\\n863678858\\r\\n719694519\\r\\n658038314\\r\\n750307459\\r\\n915589744\\r\\n530437886\\r\\n512060713\\r\\n157922588\\r\\n178644172\\r\\n5715303\\r\\n194942404\\r\\n852097346\\r\\n696406228\\r\\n891303846\\r\\n489183600\\r\\n892182349\\r\\n437838373\\r\\n390449491\\r\\n931412865\\r\\n520118475\\r\\n724052962\\r\\n624309238\\r\\n315358057\\r\\n157108994...']}, {'input': '2000 300\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...', 'output': ['510770111\\r\\n586552453\\r\\n521518610\\r\\n729496815\\r\\n925336870\\r\\n218501419\\r\\n210003823\\r\\n721775463\\r\\n410294316\\r\\n59753754\\r\\n445916833\\r\\n149785626\\r\\n397166471\\r\\n850878761\\r\\n322612228\\r\\n400512598\\r\\n962933991\\r\\n238352988\\r\\n481795882\\r\\n312429269\\r\\n230724223\\r\\n668360989\\r\\n538774766\\r\\n7521020\\r\\n782227455\\r\\n932947153\\r\\n766620629\\r\\n621895347\\r\\n948462500\\r\\n49828435\\r\\n465611859\\r\\n508795684\\r\\n965408363\\r\\n876217222\\r\\n27461852\\r\\n849541586\\r\\n889517699\\r\\n887546242\\r\\n347913548\\r\\n274305965\\r\\n434804057\\r\\n916014055\\r\\n822187302\\r\\n339400794\\r\\n604867800\\r\\n368133826\\r\\n799958426\\r...', '738045334\\r\\n159282105\\r\\n578763229\\r\\n578763229\\r\\n477846315\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n159282105\\r\\n738045334\\r\\n159282105\\r\\n159282105\\r\\n738045334\\r\\n159282105\\r\\n738045334\\r\\n159282105\\r\\n578763229\\r\\n738045334\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n738045334\\r\\n578763229\\r\\n578763229\\r\\n578763229\\r\\n159282105\\r\\n578763229\\r\\n318564210\\r\\n578763229\\r\\n578763229\\r\\n159282105\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n159282105\\r\\n578763229\\r\\n159282105\\r\\n738045334\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n578763229\\r\\n738045334\\r\\n159282105\\r\\n738045334\\r\\n318564210\\r\\n73804...', '536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n53653...', '544865927\\r\\n362689553\\r\\n554047941\\r\\n662901553\\r\\n528631083\\r\\n623245685\\r\\n408599623\\r\\n383515404\\r\\n454842332\\r\\n96411147\\r\\n49835799\\r\\n979215047\\r\\n123957189\\r\\n241194187\\r\\n232012173\\r\\n930510515\\r\\n682596137\\r\\n940690446\\r\\n985602599\\r\\n592905181\\r\\n837226469\\r\\n463026429\\r\\n366947921\\r\\n259890854\\r\\n259558215\\r\\n423037922\\r\\n336940056\\r\\n739152127\\r\\n906091574\\r\\n273663875\\r\\n103463977\\r\\n218239152\\r\\n323832313\\r\\n988397061\\r\\n861312771\\r\\n369742383\\r\\n261687399\\r\\n997579075\\r\\n494364850\\r\\n668490477\\r\\n306599552\\r\\n268740229\\r\\n776878100\\r\\n482521724\\r\\n140192033\\r\\n252172746\\r\\n5279658...', '156061854\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n52020618\\r\\n52020618\\r\\n104041236\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n156061854\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n208082472\\r\\n208082472\\r\\n104041236\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n156061854\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n52020618\\r\\n156061854\\r\\n156061854\\r\\n104041236\\r\\n52020618\\r\\n52020618\\r\\n156061854\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n156061854\\r\\n52020618\\r...', '696015721\\r\\n931773777\\r\\n559486112\\r\\n847360916\\r\\n520999237\\r\\n330674091\\r\\n901387332\\r\\n817005789\\r\\n311776972\\r\\n19589756\\r\\n894472615\\r\\n644360731\\r\\n540588993\\r\\n761762342\\r\\n387103251\\r\\n712279217\\r\\n24626123\\r\\n870308250\\r\\n487286532\\r\\n403104550\\r\\n728773592\\r\\n564260282\\r\\n775161336\\r\\n604919022\\r\\n382066884\\r\\n133895986\\r\\n14584707\\r\\n323728056\\r\\n371794589\\r\\n189832070\\r\\n664212684\\r\\n375120849\\r\\n841631912\\r\\n277833388\\r\\n899970740\\r\\n674023221\\r\\n550168651\\r\\n205864687\\r\\n292155898\\r\\n484652909\\r\\n899246785\\r\\n641496229\\r\\n604195067\\r\\n520275282\\r\\n140579824\\r\\n200828320\\r\\n88943624...', '381761597\\r\\n749914123\\r\\n734966985\\r\\n451112838\\r\\n254375974\\r\\n408043495\\r\\n50147455\\r\\n317426730\\r\\n691474180\\r\\n297424671\\r\\n16576556\\r\\n950550287\\r\\n615062290\\r\\n508772409\\r\\n574097914\\r\\n755479957\\r\\n504073337\\r\\n232598914\\r\\n376960541\\r\\n704800943\\r\\n722703963\\r\\n943084953\\r\\n852281936\\r\\n604167024\\r\\n430991955\\r\\n691776511\\r\\n979477939\\r\\n916779041\\r\\n928976757\\r\\n9004809\\r\\n66623088\\r\\n160364271\\r\\n569831785\\r\\n753768578\\r\\n10158931\\r\\n829943628\\r\\n860984852\\r\\n599688760\\r\\n746963293\\r\\n90503616\\r\\n665117495\\r\\n843614199\\r\\n773004798\\r\\n52464119\\r\\n40225734\\r\\n193061049\\r\\n476979003\\r\\n451...']}, {'input': '2000 300\\r\\n1 1 1 0 0 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0...', 'output': ['520991218\\r\\n260495609\\r\\n781486827\\r\\n281527765\\r\\n460706912\\r\\n260495609\\r\\n43738083\\r\\n819065206\\r\\n639886059\\r\\n260495609\\r\\n639886059\\r\\n520991218\\r\\n520991218\\r\\n639886059\\r\\n819065206\\r\\n520991218\\r\\n639886059\\r\\n819065206\\r\\n639886059\\r\\n43738083\\r\\n781486827\\r\\n260495609\\r\\n520991218\\r\\n781486827\\r\\n819065206\\r\\n639886059\\r\\n281527765\\r\\n819065206\\r\\n460706912\\r\\n260495609\\r\\n639886059\\r\\n260495609\\r\\n304233692\\r\\n781486827\\r\\n260495609\\r\\n260495609\\r\\n43738083\\r\\n260495609\\r\\n639886059\\r\\n260495609\\r\\n819065206\\r\\n520991218\\r\\n520991218\\r\\n639886059\\r\\n639886059\\r\\n460706912\\r\\n26049560...']}, {'input': '2000 300\\r\\n1 1 1 0 0 0 1 0 1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1...', 'output': ['967309723\\r\\n488979754\\r\\n894231131\\r\\n227079250\\r\\n800673042\\r\\n803173636\\r\\n302660701\\r\\n49359452\\r\\n361182334\\r\\n613837368\\r\\n903714465\\r\\n783149148\\r\\n772569418\\r\\n153771444\\r\\n347053203\\r\\n383800081\\r\\n305903959\\r\\n591371347\\r\\n504143617\\r\\n554819601\\r\\n711091639\\r\\n993123371\\r\\n662636534\\r\\n799549517\\r\\n755795853\\r\\n257472564\\r\\n749178682\\r\\n44165553\\r\\n754769201\\r\\n677121173\\r\\n77251408\\r\\n825363165\\r\\n94378162\\r\\n905743915\\r\\n555723948\\r\\n401067893\\r\\n365827394\\r\\n778249947\\r\\n641361749\\r\\n657808321\\r\\n76885722\\r\\n205390090\\r\\n357248290\\r\\n762413024\\r\\n471855369\\r\\n953559875\\r\\n452364595\\r...']}, {'input': '2000 300\\r\\n1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 0 1 0 0 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 0 1 1 0 1...', 'output': ['353668818\\r\\n180952778\\r\\n350267066\\r\\n85276305\\r\\n498935339\\r\\n570367769\\r\\n947922902\\r\\n520199571\\r\\n977020824\\r\\n311854081\\r\\n369942273\\r\\n709342799\\r\\n241020253\\r\\n306637091\\r\\n574362410\\r\\n924893301\\r\\n259050261\\r\\n881412462\\r\\n505397126\\r\\n426307000\\r\\n368001455\\r\\n187561592\\r\\n507502858\\r\\n422600821\\r\\n840032307\\r\\n570586935\\r\\n847077944\\r\\n633577890\\r\\n21924242\\r\\n429617104\\r\\n40169532\\r\\n200231692\\r\\n301247265\\r\\n526536756\\r\\n236599712\\r\\n449404280\\r\\n482154139\\r\\n74891321\\r\\n744845075\\r\\n202529472\\r\\n497487224\\r\\n750227627\\r\\n791509388\\r\\n365064757\\r\\n435991351\\r\\n911452637\\r\\n230155510...']}, {'input': '200000 3000\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n83030...', '746090912\\r\\n987874942\\r\\n493937471\\r\\n493937471\\r\\n241784030\\r\\n493937471\\r\\n746090912\\r\\n241784030\\r\\n746090912\\r\\n987874942\\r\\n493937471\\r\\n241784030\\r\\n493937471\\r\\n493937471\\r\\n987874942\\r\\n493937471\\r\\n987874942\\r\\n746090912\\r\\n746090912\\r\\n493937471\\r\\n746090912\\r\\n493937471\\r\\n493937471\\r\\n483568060\\r\\n493937471\\r\\n746090912\\r\\n746090912\\r\\n241784030\\r\\n746090912\\r\\n746090912\\r\\n987874942\\r\\n493937471\\r\\n746090912\\r\\n493937471\\r\\n746090912\\r\\n746090912\\r\\n746090912\\r\\n493937471\\r\\n746090912\\r\\n746090912\\r\\n746090912\\r\\n241784030\\r\\n493937471\\r\\n746090912\\r\\n241784030\\r\\n493937471\\r\\n49393...', '249477932\\r\\n163324885\\r\\n619370540\\r\\n591761649\\r\\n381202278\\r\\n400495236\\r\\n181619933\\r\\n483987183\\r\\n768059384\\r\\n853879792\\r\\n648642618\\r\\n525566838\\r\\n955999425\\r\\n754753895\\r\\n409143808\\r\\n470016419\\r\\n322658124\\r\\n100123809\\r\\n150684670\\r\\n101454359\\r\\n634006577\\r\\n229187060\\r\\n466357410\\r\\n35592186\\r\\n769389935\\r\\n547853534\\r\\n85820409\\r\\n289061762\\r\\n201245531\\r\\n244821008\\r\\n910095485\\r\\n40581744\\r\\n910760760\\r\\n733797749\\r\\n450390828\\r\\n440079067\\r\\n811634863\\r\\n573799237\\r\\n619703176\\r\\n460037301\\r\\n90144696\\r\\n512261348\\r\\n656958547\\r\\n636002401\\r\\n271099351\\r\\n573799237\\r\\n748766427...', '337242164\\r\\n175981139\\r\\n705993748\\r\\n951319188\\r\\n208728534\\r\\n926966446\\r\\n894219051\\r\\n142402527\\r\\n394342301\\r\\n747271382\\r\\n832167014\\r\\n925728471\\r\\n915824671\\r\\n371227534\\r\\n265828671\\r\\n404110515\\r\\n737503168\\r\\n526705442\\r\\n275596885\\r\\n225789012\\r\\n140757794\\r\\n548311062\\r\\n834642964\\r\\n960680644\\r\\n982693022\\r\\n298440480\\r\\n97139796\\r\\n357880981\\r\\n649164783\\r\\n74025029\\r\\n270644985\\r\\n37970467\\r\\n945129313\\r\\n422137796\\r\\n739979118\\r\\n389390401\\r\\n815106536\\r\\n311922619\\r\\n858860120\\r\\n411267193\\r\\n976503147\\r\\n835880939\\r\\n13346553\\r\\n661137775\\r\\n978979097\\r\\n527943417\\r\\n707231723...', '895547075\\r\\n50488475\\r\\n972784199\\r\\n737802803\\r\\n134349212\\r\\n579628449\\r\\n120501272\\r\\n588315405\\r\\n599840552\\r\\n714837825\\r\\n262849659\\r\\n448375127\\r\\n596572279\\r\\n172710075\\r\\n108458976\\r\\n317466571\\r\\n845058600\\r\\n348860806\\r\\n506174996\\r\\n501269960\\r\\n76979425\\r\\n561049607\\r\\n754144168\\r\\n500496863\\r\\n56852638\\r\\n736253107\\r\\n323142953\\r\\n631062404\\r\\n987492303\\r\\n864152840\\r\\n155163780\\r\\n16686131\\r\\n341291713\\r\\n213479047\\r\\n623578627\\r\\n815212310\\r\\n74571316\\r\\n580316230\\r\\n11782846\\r\\n9977202\\r\\n56164857\\r\\n453363728\\r\\n283577160\\r\\n112674480\\r\\n770828548\\r\\n441236116\\r\\n475210843\\r\\n997...', '743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n74369...', '743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n74369...', '34499784\\r\\n374247743\\r\\n362747815\\r\\n297560637\\r\\n574121750\\r\\n869682055\\r\\n449997441\\r\\n458622387\\r\\n930182193\\r\\n940681955\\r\\n376622642\\r\\n28249737\\r\\n622933686\\r\\n969931858\\r\\n400622664\\r\\n671871138\\r\\n811807848\\r\\n331623096\\r\\n223311188\\r\\n305748258\\r\\n203623639\\r\\n439935004\\r\\n185436339\\r\\n481622243\\r\\n517559518\\r\\n585621678\\r\\n66124586\\r\\n679996001\\r\\n894244918\\r\\n45999712\\r\\n243436062\\r\\n887057463\\r\\n525184298\\r\\n990056732\\r\\n154311620\\r\\n198873841\\r\\n227623661\\r\\n430809975\\r\\n12937419\\r\\n194561368\\r\\n140374035\\r\\n610059025\\r\\n715495951\\r\\n677058261\\r\\n731308352\\r\\n710120554\\r\\n143749100\\r...', '743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n74369...', '563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n56365...', '948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n94886...', '616415891\\r\\n743692045\\r\\n743692045\\r\\n616415891\\r\\n489139737\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n870968199\\r\\n616415891\\r\\n743692045\\r\\n616415891\\r\\n743692045\\r\\n743692045\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n489139737\\r\\n870968199\\r\\n870968199\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n616415891\\r\\n743692045\\r\\n743692045\\r\\n743692045\\r\\n361863583\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n870968199\\r\\n616415891\\r\\n870968199\\r\\n743692045\\r\\n743692045\\r\\n107311275\\r\\n743692045\\r\\n870968199\\r\\n870968199\\r\\n87096...']}, {'input': '200000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['534464893\\r\\n70685433\\r\\n141370866\\r\\n605150326\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n605150326\\r\\n605150326\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n141370866\\r\\n70685433\\r\\n534464893\\r\\n141370866\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n534464893\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n70685433\\r\\n605150326\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n...', '434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n43434...', '479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n47934...', '983882738\\r\\n723119688\\r\\n459823065\\r\\n556901314\\r\\n70724963\\r\\n266615302\\r\\n669551615\\r\\n128160584\\r\\n374823721\\r\\n636048406\\r\\n410086236\\r\\n880577836\\r\\n119251355\\r\\n80183061\\r\\n594759171\\r\\n13376576\\r\\n422252375\\r\\n548479185\\r\\n235532967\\r\\n555429175\\r\\n697576973\\r\\n194705367\\r\\n244991065\\r\\n696417466\\r\\n575930209\\r\\n911572937\\r\\n690252582\\r\\n173917166\\r\\n286156762\\r\\n203240195\\r\\n371392343\\r\\n232850391\\r\\n10955702\\r\\n65159878\\r\\n81942367\\r\\n928468125\\r\\n286592932\\r\\n499727395\\r\\n803102816\\r\\n81855133\\r\\n235158566\\r\\n824901521\\r\\n295851097\\r\\n716980269\\r\\n913157775\\r\\n996485047\\r\\n807919099\\r\\n4...', '535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n53563...', '483259721\\r\\n483259721\\r\\n451534810\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n709027126\\r\\n483259721\\r\\n966519442\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n740752037\\r\\n225767405\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n451534810\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n966519442\\r\\n225767405\\r\\n740752037\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n740752037\\r\\n740752037\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n225767405\\r\\n740752037\\r\\n483259721\\r\\n225767405\\r\\n740752037\\r\\n74075...', '365182673\\r\\n453133330\\r\\n646237559\\r\\n383557795\\r\\n419033749\\r\\n340436101\\r\\n116418016\\r\\n678527788\\r\\n945667567\\r\\n79030627\\r\\n870994872\\r\\n815130278\\r\\n370916978\\r\\n677151415\\r\\n467150520\\r\\n882361399\\r\\n890542201\\r\\n249936864\\r\\n39196741\\r\\n947579002\\r\\n636680384\\r\\n295607138\\r\\n675342063\\r\\n808325849\\r\\n29104504\\r\\n25918779\\r\\n103037971\\r\\n291784268\\r\\n445589673\\r\\n215200138\\r\\n658241231\\r\\n704446567\\r\\n478414964\\r\\n374535682\\r\\n193639291\\r\\n871632017\\r\\n186732779\\r\\n291784268\\r\\n138616008\\r\\n491795009\\r\\n475331322\\r\\n689894315\\r\\n243667497\\r\\n853256895\\r\\n714003742\\r\\n774124185\\r\\n363271238...', '985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n98542...', '155925765\\r\\n487818429\\r\\n547205425\\r\\n780737503\\r\\n891037610\\r\\n578930143\\r\\n825301017\\r\\n138861660\\r\\n552655747\\r\\n896394864\\r\\n881431780\\r\\n167493014\\r\\n480546290\\r\\n147428613\\r\\n697960072\\r\\n762448385\\r\\n870903408\\r\\n251332589\\r\\n614973238\\r\\n898519152\\r\\n581333635\\r\\n223833180\\r\\n271513325\\r\\n829479792\\r\\n130457576\\r\\n488950374\\r\\n631091534\\r\\n259853008\\r\\n403102846\\r\\n643511524\\r\\n491144463\\r\\n683066789\\r\\n279987210\\r\\n916459265\\r\\n497517327\\r\\n461078693\\r\\n513286618\\r\\n11055375\\r\\n943036132\\r\\n453946156\\r\\n770116063\\r\\n285321197\\r\\n954649915\\r\\n686299755\\r\\n305432132\\r\\n314991428\\r\\n917591...', '979248391\\r\\n467909552\\r\\n175190733\\r\\n498757573\\r\\n436634896\\r\\n282945489\\r\\n831422982\\r\\n525572199\\r\\n608769567\\r\\n291190788\\r\\n623553625\\r\\n907228321\\r\\n19120025\\r\\n908756352\\r\\n635157558\\r\\n367120190\\r\\n895500325\\r\\n121864053\\r\\n271093430\\r\\n805461626\\r\\n799170993\\r\\n621048261\\r\\n209948086\\r\\n214834751\\r\\n291190788\\r\\n88084033\\r\\n941559039\\r\\n256433435\\r\\n462472189\\r\\n261870798\\r\\n718354926\\r\\n62673375\\r\\n599120300\\r\\n207566785\\r\\n71042737\\r\\n669914911\\r\\n844128311\\r\\n594233635\\r\\n758976277\\r\\n186492094\\r\\n238841441\\r\\n949377703\\r\\n280013490\\r\\n621474896\\r\\n309333480\\r\\n356245464\\r\\n817740320...']}, {'input': '200000 3000\\r\\n0 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 1 1 1 1 0 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 ...', 'output': ['684128648\\r\\n534537704\\r\\n70831055\\r\\n605368759\\r\\n605368759\\r\\n534537704\\r\\n55897238\\r\\n70831055\\r\\n534537704\\r\\n534537704\\r\\n605368759\\r\\n684128648\\r\\n55897238\\r\\n740025886\\r\\n534537704\\r\\n70831055\\r\\n70831055\\r\\n684128648\\r\\n70831055\\r\\n684128648\\r\\n425910181\\r\\n70831055\\r\\n605368759\\r\\n534537704\\r\\n534537704\\r\\n605368759\\r\\n684128648\\r\\n70831055\\r\\n684128648\\r\\n605368759\\r\\n70831055\\r\\n370012943\\r\\n370012943\\r\\n370012943\\r\\n605368759\\r\\n70831055\\r\\n534537704\\r\\n70831055\\r\\n370012943\\r\\n141662110\\r\\n534537704\\r\\n370012943\\r\\n370012943\\r\\n70831055\\r\\n684128648\\r\\n370012943\\r\\n684128648\\r\\n5345377...']}, {'input': '200000 3000\\r\\n1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 1 0 0 0 1 1 1 1 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ...', 'output': ['331265679\\r\\n248932636\\r\\n609274319\\r\\n474255977\\r\\n102055814\\r\\n485644908\\r\\n626044190\\r\\n431097835\\r\\n319780031\\r\\n47044666\\r\\n687413158\\r\\n404806427\\r\\n125126455\\r\\n282606731\\r\\n307585492\\r\\n584577913\\r\\n604465119\\r\\n366599088\\r\\n490459582\\r\\n11853006\\r\\n753101524\\r\\n749114305\\r\\n816668970\\r\\n25465595\\r\\n942396724\\r\\n387086401\\r\\n558715961\\r\\n470999022\\r\\n908318742\\r\\n535377307\\r\\n712631115\\r\\n501708418\\r\\n465458062\\r\\n906281962\\r\\n309027298\\r\\n466289495\\r\\n88346508\\r\\n21689911\\r\\n46580591\\r\\n650678352\\r\\n435081076\\r\\n202663995\\r\\n554027989\\r\\n280201535\\r\\n865380747\\r\\n516485969\\r\\n226759102\\r\\n...']}, {'input': '200000 3000\\r\\n0 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 1 0 1 ...', 'output': ['702758762\\r\\n222668721\\r\\n663197048\\r\\n675792950\\r\\n759259581\\r\\n332486741\\r\\n171127920\\r\\n414458191\\r\\n349087590\\r\\n847918503\\r\\n522872021\\r\\n540727038\\r\\n813504457\\r\\n278812310\\r\\n949679696\\r\\n784095578\\r\\n918470307\\r\\n482110597\\r\\n535952792\\r\\n109088580\\r\\n967478176\\r\\n268019403\\r\\n523209396\\r\\n80286422\\r\\n566422901\\r\\n182974112\\r\\n166764579\\r\\n716767192\\r\\n203579125\\r\\n975507557\\r\\n770975186\\r\\n884777286\\r\\n433828625\\r\\n891459014\\r\\n519109900\\r\\n907459392\\r\\n591988953\\r\\n479131884\\r\\n989822907\\r\\n846824242\\r\\n304414023\\r\\n13755521\\r\\n6710438\\r\\n355497544\\r\\n718926904\\r\\n912736930\\r\\n173287893...']}, {'input': '10 3000\\r\\n1 1 1 1 1 0 0 0 1 1\\r\\n6 22 5 2 4 15 4 7 31 4\\r\\n', 'output': ['561258918\\r\\n61460660\\r\\n467715765\\r\\n187086306\\r\\n374172612\\r\\n538110090\\r\\n143496024\\r\\n251118042\\r\\n903349037\\r\\n374172612']}, {'input': '100 3000\\r\\n0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n10 8 1 9 7 5 12 9 15 7 16 5 17 5 17 21 11 3 4 4 30 17 3 84 12 30 2 8 2 2 22 24 15 11 15 13 7 17 1 12 8 4 3 6 5 15 1 3 4 2 27 3 11 11 3 3 3 5 14 2 5 13 6 2 6 5 6 19 3 16 4 12 11 2 2 3 25 14 6 11 22 4 10 32 9 19 14 2 2 3 4 3 2 5 18 14 2 7 3 8\\r\\n', 'output': ['23677346\\r\\n418239618\\r\\n800963217\\r\\n220958482\\r\\n615520754\\r\\n11838673\\r\\n627359427\\r\\n220958482\\r\\n35516019\\r\\n615520754\\r\\n836479236\\r\\n11838673\\r\\n639198100\\r\\n11838673\\r\\n639198100\\r\\n848317909\\r\\n824640563\\r\\n406400945\\r\\n209119809\\r\\n209119809\\r\\n71032038\\r\\n639198100\\r\\n406400945\\r\\n398538577\\r\\n627359427\\r\\n71032038\\r\\n603682081\\r\\n418239618\\r\\n19778681\\r\\n603682081\\r\\n651036773\\r\\n256474501\\r\\n35516019\\r\\n824640563\\r\\n35516019\\r\\n430078291\\r\\n615520754\\r\\n639198100\\r\\n800963217\\r\\n627359427\\r\\n418239618\\r\\n209119809\\r\\n406400945\\r\\n812801890\\r\\n11838673\\r\\n35516019\\r\\n800963217\\r\\n406400...']}, {'input': '1000 3000\\r\\n0 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 ...', 'output': ['984664827\\r\\n971085301\\r\\n837724678\\r\\n984664827\\r\\n225735001\\r\\n971085301\\r\\n984664827\\r\\n611989677\\r\\n65215326\\r\\n611989677\\r\\n837724678\\r\\n984664827\\r\\n225735001\\r\\n984664827\\r\\n971085301\\r\\n225735001\\r\\n225735001\\r\\n984664827\\r\\n971085301\\r\\n957505775\\r\\n971085301\\r\\n984664827\\r\\n943926249\\r\\n225735001\\r\\n971085301\\r\\n611989677\\r\\n837724678\\r\\n971085301\\r\\n225735001\\r\\n971085301\\r\\n225735001\\r\\n971085301\\r\\n984664827\\r\\n971085301\\r\\n943926249\\r\\n943926249\\r\\n611989677\\r\\n971085301\\r\\n984664827\\r\\n957505775\\r\\n971085301\\r\\n225735001\\r\\n971085301\\r\\n971085301\\r\\n225735001\\r\\n837724678\\r\\n611989...']}, {'input': '1000 3000\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['499122179\\r\\n5\\r\\n499122179\\r\\n5\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122184\\r\\n499122179\\r\\n5\\r\\n5\\r\\n5\\r\\n499122184\\r\\n10\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122184\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n5\\r\\n499122184\\r\\n5\\r\\n499122184\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122184\\r\\n499122184\\r\\n5...']}, {'input': '199990 3000\\r\\n1 0 0 1 0 1 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 0 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 ...', 'output': ['646452156\\r\\n960868656\\r\\n118518242\\r\\n184272685\\r\\n747024268\\r\\n964037469\\r\\n951101180\\r\\n377347150\\r\\n254993892\\r\\n11139421\\r\\n70322210\\r\\n525571057\\r\\n926475930\\r\\n63428346\\r\\n756018063\\r\\n626131891\\r\\n466781454\\r\\n656042659\\r\\n69698706\\r\\n359694160\\r\\n226813875\\r\\n191435355\\r\\n897230167\\r\\n851910875\\r\\n872964055\\r\\n741910138\\r\\n963242791\\r\\n859073545\\r\\n501205753\\r\\n252469038\\r\\n77916365\\r\\n622358084\\r\\n867246600\\r\\n381481659\\r\\n57646031\\r\\n326439010\\r\\n37314488\\r\\n267966014\\r\\n386173645\\r\\n224253188\\r\\n693822089\\r\\n652063749\\r\\n209704954\\r\\n936775840\\r\\n675102836\\r\\n581756207\\r\\n18809453\\r\\n84...']}, {'input': '199991 3000\\r\\n1 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 1 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 ...', 'output': ['576788803\\r\\n851579816\\r\\n464431389\\r\\n925910539\\r\\n240339104\\r\\n317886519\\r\\n67707478\\r\\n262772669\\r\\n221595177\\r\\n612937974\\r\\n736137684\\r\\n268724388\\r\\n68361383\\r\\n847191682\\r\\n557301933\\r\\n913346054\\r\\n648280739\\r\\n171995554\\r\\n235269506\\r\\n530242292\\r\\n148650394\\r\\n908499525\\r\\n304200830\\r\\n721371958\\r\\n474031015\\r\\n817280262\\r\\n825707282\\r\\n465373250\\r\\n245622892\\r\\n341231679\\r\\n845696111\\r\\n853007293\\r\\n68361383\\r\\n915771149\\r\\n987480726\\r\\n726171771\\r\\n707992711\\r\\n478931968\\r\\n847890178\\r\\n687514833\\r\\n732279394\\r\\n927044872\\r\\n856499296\\r\\n862463110\\r\\n77307104\\r\\n484794642\\r\\n615409785...']}, {'input': '199992 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 ...', 'output': ['944579271\\r\\n815447430\\r\\n121435610\\r\\n89385736\\r\\n85360285\\r\\n56962924\\r\\n289585947\\r\\n344015172\\r\\n223771444\\r\\n652123221\\r\\n591303048\\r\\n4248454\\r\\n306743823\\r\\n968709911\\r\\n670850059\\r\\n672191876\\r\\n417953645\\r\\n24521845\\r\\n946915719\\r\\n777789018\\r\\n60838440\\r\\n839186865\\r\\n79733480\\r\\n134590444\\r\\n755625163\\r\\n504520550\\r\\n752912502\\r\\n172585260\\r\\n452314215\\r\\n812559060\\r\\n865646468\\r\\n584772439\\r\\n717751255\\r\\n344015172\\r\\n217454686\\r\\n551825\\r\\n985330789\\r\\n733776192\\r\\n951920831\\r\\n371680341\\r\\n447096882\\r\\n332238689\\r\\n688429333\\r\\n390729899\\r\\n623930596\\r\\n453096625\\r\\n858100172\\r\\n14638...']}, {'input': '199993 3000\\r\\n1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['189220773\\r\\n219328456\\r\\n767760662\\r\\n806220888\\r\\n797979411\\r\\n545740580\\r\\n219383989\\r\\n75297991\\r\\n40929720\\r\\n935115229\\r\\n532004785\\r\\n529257626\\r\\n49282263\\r\\n789793467\\r\\n545740580\\r\\n962586819\\r\\n485358615\\r\\n471678353\\r\\n907699172\\r\\n803473729\\r\\n408604762\\r\\n963918788\\r\\n35602001\\r\\n847372740\\r\\n611561330\\r\\n216636830\\r\\n729467035\\r\\n298885001\\r\\n73784562\\r\\n95928433\\r\\n405857603\\r\\n312620796\\r\\n126147182\\r\\n518268990\\r\\n353717115\\r\\n501841569\\r\\n512830205\\r\\n685568024\\r\\n252294364\\r\\n962586819\\r\\n477172671\\r\\n252637898\\r\\n246744513\\r\\n434391811\\r\\n52084955\\r\\n807039242\\r\\n414043547\\r\\n2...']}, {'input': '199994 3000\\r\\n0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 ...', 'output': ['336654971\\r\\n732535\\r\\n815250185\\r\\n326444659\\r\\n729180253\\r\\n129624924\\r\\n358796707\\r\\n444866639\\r\\n754810869\\r\\n843551608\\r\\n256744726\\r\\n70820418\\r\\n164515107\\r\\n207034102\\r\\n575220043\\r\\n87535002\\r\\n682699176\\r\\n43984065\\r\\n797070531\\r\\n806189316\\r\\n815982720\\r\\n704840912\\r\\n900587582\\r\\n585042405\\r\\n921264248\\r\\n459213067\\r\\n352526818\\r\\n883140463\\r\\n815669240\\r\\n511377385\\r\\n785483692\\r\\n225259507\\r\\n505565288\\r\\n832271475\\r\\n46481077\\r\\n860266192\\r\\n560703064\\r\\n99613410\\r\\n150730663\\r\\n410704936\\r\\n704840912\\r\\n915837096\\r\\n953960881\\r\\n968477860\\r\\n589004487\\r\\n187389378\\r\\n517884662\\r\\n93...']}, {'input': '199995 3000\\r\\n0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 ...', 'output': ['662762303\\r\\n929872487\\r\\n874878479\\r\\n456275271\\r\\n715183658\\r\\n400437516\\r\\n521458497\\r\\n76578537\\r\\n927594887\\r\\n897280874\\r\\n185062970\\r\\n530346011\\r\\n941267798\\r\\n71793140\\r\\n377419134\\r\\n675559304\\r\\n591654880\\r\\n719511098\\r\\n599406031\\r\\n622421976\\r\\n250476393\\r\\n605557988\\r\\n772627865\\r\\n133099572\\r\\n594620634\\r\\n848508553\\r\\n404542070\\r\\n193952921\\r\\n255031593\\r\\n40568087\\r\\n771704693\\r\\n756662785\\r\\n869935052\\r\\n847369753\\r\\n36238210\\r\\n358730629\\r\\n164552385\\r\\n938076721\\r\\n767600139\\r\\n458579571\\r\\n693757159\\r\\n843723156\\r\\n975014694\\r\\n858992824\\r\\n955398666\\r\\n756432588\\r\\n585958443...']}, {'input': '199996 3000\\r\\n0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 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 1 1 0 ...', 'output': ['670876956\\r\\n282683795\\r\\n377011834\\r\\n803395587\\r\\n676385588\\r\\n935914218\\r\\n718622147\\r\\n536417373\\r\\n403228588\\r\\n282205508\\r\\n715874782\\r\\n593703261\\r\\n180906172\\r\\n125082949\\r\\n159213672\\r\\n79114647\\r\\n828013417\\r\\n919922217\\r\\n269261194\\r\\n677998414\\r\\n539957249\\r\\n116020539\\r\\n719578721\\r\\n947915860\\r\\n933837007\\r\\n911830283\\r\\n475864127\\r\\n320232037\\r\\n207122926\\r\\n915004383\\r\\n801796663\\r\\n301300804\\r\\n489000308\\r\\n929955103\\r\\n208735752\\r\\n169096397\\r\\n431236133\\r\\n485282467\\r\\n675865595\\r\\n711172563\\r\\n31711484\\r\\n780760415\\r\\n330893371\\r\\n339149368\\r\\n107928605\\r\\n630648538\\r\\n1150500...']}, {'input': '199997 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['509540793\\r\\n120976575\\r\\n549866318\\r\\n103886913\\r\\n46471726\\r\\n486304930\\r\\n356783524\\r\\n889560180\\r\\n199228995\\r\\n889560180\\r\\n825998792\\r\\n728258080\\r\\n40325525\\r\\n723460820\\r\\n584045642\\r\\n849234655\\r\\n398457990\\r\\n44073096\\r\\n355733835\\r\\n753892573\\r\\n259042812\\r\\n526630455\\r\\n218717287\\r\\n69707589\\r\\n445979405\\r\\n843088454\\r\\n549866318\\r\\n900503641\\r\\n915194673\\r\\n110033114\\r\\n233408319\\r\\n632915998\\r\\n443580775\\r\\n883413979\\r\\n356783524\\r\\n63561388\\r\\n314059369\\r\\n628118738\\r\\n543720117\\r\\n420344912\\r\\n705022217\\r\\n89195881\\r\\n535175286\\r\\n987300892\\r\\n72106219\\r\\n543720117\\r\\n785673267\\r\\n2...', '791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n79153...']}, {'input': '199998 3000\\r\\n1 0 1 1 1 0 1 0 1 1 1 1 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 1 1 1 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 0 1 1 0 1 1 1 1 0 0 0 1 0 1 1 1 0 0 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 1 1 1 0 0 1 1 0 0 ...', 'output': ['728321596\\r\\n638956912\\r\\n987568459\\r\\n799092377\\r\\n597086927\\r\\n782772546\\r\\n770287170\\r\\n255784080\\r\\n699516389\\r\\n256762390\\r\\n656812813\\r\\n513524780\\r\\n416026596\\r\\n285567597\\r\\n279669471\\r\\n136357125\\r\\n790734343\\r\\n479381626\\r\\n898668365\\r\\n822581531\\r\\n870855601\\r\\n827897584\\r\\n408064799\\r\\n759611276\\r\\n235779603\\r\\n990282556\\r\\n571135194\\r\\n279669471\\r\\n311516659\\r\\n287631268\\r\\n607109724\\r\\n822559637\\r\\n639460200\\r\\n369129744\\r\\n111968446\\r\\n157186402\\r\\n495141278\\r\\n652212868\\r\\n143815634\\r\\n367752526\\r\\n165008822\\r\\n592117981\\r\\n400788425\\r\\n793754430\\r\\n966900453\\r\\n2484473\\r\\n9089752...', '964927693\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n96492...']}, {'input': '199999 3000\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 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 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 1 1 1 0 1 1 ...', 'output': ['659992102\\r\\n43534688\\r\\n613251861\\r\\n688791385\\r\\n969096633\\r\\n244584877\\r\\n407865304\\r\\n186960964\\r\\n243317864\\r\\n549539932\\r\\n991833247\\r\\n262687380\\r\\n543128826\\r\\n494636937\\r\\n223625258\\r\\n610530943\\r\\n823731817\\r\\n148706567\\r\\n321255216\\r\\n793342431\\r\\n574351284\\r\\n666241663\\r\\n731705240\\r\\n759075965\\r\\n574351284\\r\\n267483036\\r\\n533214424\\r\\n650213898\\r\\n38254397\\r\\n748651581\\r\\n341432457\\r\\n458755021\\r\\n851102542\\r\\n458618823\\r\\n777016923\\r\\n879306339\\r\\n831596828\\r\\n223948348\\r\\n334458632\\r\\n214654779\\r\\n250672893\\r\\n599162636\\r\\n601914362\\r\\n888897651\\r\\n620419998\\r\\n546470577\\r\\n2155987...', '959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n550771238\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n550771238\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n95962...']}, {'input': '200000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 ...', 'output': ['893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n917300718\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n89340...', '777798569\\r\\n231173131\\r\\n230887037\\r\\n573284389\\r\\n184819702\\r\\n389069614\\r\\n336642733\\r\\n374568480\\r\\n855432105\\r\\n25206655\\r\\n4356888\\r\\n605147597\\r\\n575616793\\r\\n296362756\\r\\n407873071\\r\\n112177054\\r\\n213967495\\r\\n814007752\\r\\n159623960\\r\\n280717246\\r\\n614422648\\r\\n758973286\\r\\n52239134\\r\\n765343745\\r\\n464084652\\r\\n192059356\\r\\n447272940\\r\\n617899428\\r\\n590679202\\r\\n570104616\\r\\n874554395\\r\\n774321789\\r\\n991301706\\r\\n991873894\\r\\n397156637\\r\\n113523353\\r\\n617052059\\r\\n46639523\\r\\n446403745\\r\\n35361814\\r\\n921640272\\r\\n891146426\\r\\n273084002\\r\\n58808253\\r\\n533015325\\r\\n30707919\\r\\n154980978\\r\\n71...']}, {'input': '200000 3000\\r\\n1 0 0 0 0 1 0 0 0 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 0 ...', 'output': ['203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n71266...']}, {'input': '200000 3000\\r\\n0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 ...', 'output': ['532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n53...']}]","id":31} {"description":"Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she solved all the tasks momentarily and now suggests you to solve one of them as well.We define a pair of integers (a,\u2009b) good, if GCD(a,\u2009b)\u2009=\u2009x and LCM(a,\u2009b)\u2009=\u2009y, where GCD(a,\u2009b) denotes the greatest common divisor of a and b, and LCM(a,\u2009b) denotes the least common multiple of a and b.You are given two integers x and y. You are to find the number of good pairs of integers (a,\u2009b) such that l\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009r. Note that pairs (a,\u2009b) and (b,\u2009a) are considered different if a\u2009\u2260\u2009b.","input_specification":"The only line contains four integers l,\u2009r,\u2009x,\u2009y (1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009109, 1\u2009\u2264\u2009x\u2009\u2264\u2009y\u2009\u2264\u2009109).","output_specification":"In the only line print the only integer\u00a0\u2014 the answer for the problem.","notes":"NoteIn the first example there are two suitable good pairs of integers (a,\u2009b): (1,\u20092) and (2,\u20091).In the second example there are four suitable good pairs of integers (a,\u2009b): (1,\u200912), (12,\u20091), (3,\u20094) and (4,\u20093).In the third example there are good pairs of integers, for example, (3,\u200930), but none of them fits the condition l\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009r.","sample_inputs":["1 2 1 2","1 12 1 12","50 100 3 30"],"sample_outputs":["2","4","0"],"src_uid":"d37dde5841116352c9b37538631d0b15","lang_cluster":"C++","difficulty":1600,"human_solution":"\/*\n ID: osama2\n LANG: C++\n PROG: beads\n*\/\n#include \n#include \n#include \nusing namespace std;\nusing namespace __gnu_pbds;\n#define ll long long\n#define int long long\n#define imfaast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);\ntemplateusing ordered_set = tree,rb_tree_tag,tree_order_statistics_node_update>;\/\/find_by_order(ind);\nint dx[]= {0,0,-1,1,1,-1,1,-1};\nint dy[]= {1,-1,0,0,1,-1,-1,1};\n#define f first\n#define s second\nint oo=1e3;\nconst int mod=1e9+7;\nconst int N=1;\nconst int N2=105;\n#define endl '\\n'\n#define mem memset(dp,-1,sizeof(dp));\nint gcd(int a,int b)\n{\n \/\/ O(log(a*b)) GCD calculater\n if(b>a)swap(a,b);\n if(b==0)return a;\n return gcd(b,a%b);\n}\nvoid doswaps(int& a,int&b,int q)\n{\n int n=a-q*b;\n a=b;\n b=n;\n}\nint egcd(int a,int b,int& x0,int& y0)\n{\n int x1,y1;\n x1=y0=0;\n x0=y1=1;\n int r0=a,r1=b;\n while(r1!=0)\n {\n int q=r0\/r1;\n doswaps(x0,x1,q);\n doswaps(y0,y1,q);\n doswaps(r0,r1,q);\n }\n return r0;\n}\n\nll fpow(int b,int p)\/\/ fast power\n{\n if(p==1)return b;\n ll ret= fpow(b,p\/2);\n ret*=ret;\n ret%=mod;\n if(p%2)ret= ret * b % mod;\n return ret%mod;\n}\nll fact[N];\nvoid pre(int n)\n{\n fact[0]=1;\n for(int i=1; in)return 0;\n ll ret= fact[n];\n ll d= fact[n-r];\n d*=fact[r];\n d%=mod;\n return (ret*fpow(d,mod-2))%mod;\n}\n\n\nsigned main()\n{\n imfaast\n\/\/ freopen(\"input.txt\",\"r\",stdin);\n\/\/ freopen(\"billboard.out\",\"w\",stdout);\n int l,r,x,y;cin>>l>>r>>x>>y;\n if(y%x)\n {\n cout << 0<=l&&i*x<=r&&j*x>=l&&j*x<=r&&gcd(i,j)==1)\n {\n ans++;\n if(i!=j)ans++;\n }\n }\n }\n cout << ans;\n\n\n}\n\n \t \t \t \t \t\t \t\t\t \t\t\t\t","testcases":"[{'input': '1 2 1 2\\r\\n', 'output': ['2']}, {'input': '1 12 1 12\\r\\n', 'output': ['4']}, {'input': '50 100 3 30\\r\\n', 'output': ['0']}, {'input': '1 1000000000 1 1000000000\\r\\n', 'output': ['4']}, {'input': '1 1000000000 158260522 200224287\\r\\n', 'output': ['0']}, {'input': '1 1000000000 2 755829150\\r\\n', 'output': ['8']}, {'input': '1 1000000000 158260522 158260522\\r\\n', 'output': ['1']}, {'input': '1 1000000000 877914575 877914575\\r\\n', 'output': ['1']}, {'input': '232 380232688 116 760465376\\r\\n', 'output': ['30']}, {'input': '47259 3393570 267 600661890\\r\\n', 'output': ['30']}, {'input': '1 1000000000 1 672672000\\r\\n', 'output': ['64']}, {'input': '1000000000 1000000000 1000000000 1000000000\\r\\n', 'output': ['1']}, {'input': '1 1000000000 1 649209600\\r\\n', 'output': ['32']}, {'input': '1 1000000000 1 682290000\\r\\n', 'output': ['32']}, {'input': '1 1000000000 1 228614400\\r\\n', 'output': ['16']}, {'input': '1 1000000000 1 800280000\\r\\n', 'output': ['32']}, {'input': '1 1000000000 1 919987200\\r\\n', 'output': ['16']}, {'input': '1 1000000000 1 456537870\\r\\n', 'output': ['64']}, {'input': '1 1000000000 1 7198102\\r\\n', 'output': ['8']}, {'input': '1 1000000000 1 58986263\\r\\n', 'output': ['16']}, {'input': '1 1000000000 1 316465536\\r\\n', 'output': ['16']}, {'input': '1 1000000000 1 9558312\\r\\n', 'output': ['16']}, {'input': '1 1000000000 1 5461344\\r\\n', 'output': ['16']}, {'input': '58 308939059 29 617878118\\r\\n', 'output': ['62']}, {'input': '837 16262937 27 504151047\\r\\n', 'output': ['28']}, {'input': '47275 402550 25 761222050\\r\\n', 'output': ['12']}, {'input': '22 944623394 22 944623394\\r\\n', 'output': ['32']}, {'input': '1032 8756124 12 753026664\\r\\n', 'output': ['18']}, {'input': '7238 939389 11 618117962\\r\\n', 'output': ['10']}, {'input': '58351 322621 23 818489477\\r\\n', 'output': ['6']}, {'input': '3450 7068875 25 975504750\\r\\n', 'output': ['86']}, {'input': '13266 1606792 22 968895576\\r\\n', 'output': ['14']}, {'input': '21930 632925 15 925336350\\r\\n', 'output': ['42']}, {'input': '2193 4224517 17 544962693\\r\\n', 'output': ['42']}, {'input': '526792 39807152 22904 915564496\\r\\n', 'output': ['8']}, {'input': '67728 122875524 16932 491502096\\r\\n', 'output': ['12']}, {'input': '319813 63298373 24601 822878849\\r\\n', 'output': ['6']}, {'input': '572464 23409136 15472 866138032\\r\\n', 'output': ['4']}, {'input': '39443 809059020 19716 777638472\\r\\n', 'output': ['12']}, {'input': '2544768 8906688 27072 837228672\\r\\n', 'output': ['0']}, {'input': '413592 46975344 21768 892531536\\r\\n', 'output': ['10']}, {'input': '11349 816231429 11349 816231429\\r\\n', 'output': ['8']}, {'input': '16578 939956022 16578 939956022\\r\\n', 'output': ['4']}, {'input': '2783175 6882425 21575 887832825\\r\\n', 'output': ['2']}, {'input': '2862252 7077972 22188 913058388\\r\\n', 'output': ['2']}, {'input': '1856828 13124976 25436 958123248\\r\\n', 'output': ['6']}, {'input': '100 1000000000 158260522 158260522\\r\\n', 'output': ['1']}, {'input': '100 1000000000 877914575 877914575\\r\\n', 'output': ['1']}, {'input': '100 1000000000 602436426 602436426\\r\\n', 'output': ['1']}, {'input': '100 1000000000 24979445 24979445\\r\\n', 'output': ['1']}, {'input': '1 1000000000 18470 112519240\\r\\n', 'output': ['4']}, {'input': '1 1000000000 22692 2201124\\r\\n', 'output': ['2']}, {'input': '1 1000000000 24190 400949250\\r\\n', 'output': ['16']}, {'input': '1 1000000000 33409 694005157\\r\\n', 'output': ['2']}, {'input': '1 1000000000 24967 470827686\\r\\n', 'output': ['16']}, {'input': '1 1000000000 35461 152517761\\r\\n', 'output': ['8']}, {'input': '2 1000000000 158260522 200224287\\r\\n', 'output': ['0']}, {'input': '2 1000000000 602436426 611751520\\r\\n', 'output': ['0']}, {'input': '2 1000000000 861648772 942726551\\r\\n', 'output': ['0']}, {'input': '2 1000000000 433933447 485982495\\r\\n', 'output': ['0']}, {'input': '2 1000000000 262703497 480832794\\r\\n', 'output': ['0']}, {'input': '2672374 422235092 1336187 844470184\\r\\n', 'output': ['2']}, {'input': '1321815 935845020 1321815 935845020\\r\\n', 'output': ['8']}, {'input': '29259607 69772909 2250739 907047817\\r\\n', 'output': ['2']}, {'input': '11678540 172842392 2335708 864211960\\r\\n', 'output': ['4']}, {'input': '297 173688298 2876112 851329152\\r\\n', 'output': ['2']}, {'input': '7249 55497026 659 610467286\\r\\n', 'output': ['28']}, {'input': '398520 1481490 810 728893080\\r\\n', 'output': ['4']}, {'input': '2354 369467362 1177 738934724\\r\\n', 'output': ['14']}, {'input': '407264 2497352 1144 889057312\\r\\n', 'output': ['2']}, {'input': '321399 1651014 603 879990462\\r\\n', 'output': ['4']}, {'input': '475640 486640 440 526057840\\r\\n', 'output': ['2']}, {'input': '631714 179724831 1136 717625968\\r\\n', 'output': ['0']}, {'input': '280476 1595832 588 761211864\\r\\n', 'output': ['8']}, {'input': '10455 39598005 615 673166085\\r\\n', 'output': ['6']}, {'input': '24725 19759875 575 849674625\\r\\n', 'output': ['22']}, {'input': '22 158 2 1738\\r\\n', 'output': ['2']}, {'input': '1 2623 1 2623\\r\\n', 'output': ['4']}, {'input': '7 163677675 3 18\\r\\n', 'output': ['0']}, {'input': '159 20749927 1 158\\r\\n', 'output': ['0']}, {'input': '5252 477594071 1 5251\\r\\n', 'output': ['0']}, {'input': '2202 449433679 3 6603\\r\\n', 'output': ['0']}, {'input': '6 111 3 222\\r\\n', 'output': ['2']}, {'input': '26 46 2 598\\r\\n', 'output': ['2']}, {'input': '26 82 2 1066\\r\\n', 'output': ['2']}, {'input': '1 2993 1 2993\\r\\n', 'output': ['4']}, {'input': '17 17 1 289\\r\\n', 'output': ['0']}, {'input': '177 267 3 15753\\r\\n', 'output': ['2']}, {'input': '7388 22705183 1 7387\\r\\n', 'output': ['0']}, {'input': '1 100 3 100\\r\\n', 'output': ['0']}, {'input': '1 1000 6 1024\\r\\n', 'output': ['0']}, {'input': '1 100 2 4\\r\\n', 'output': ['2']}, {'input': '1 10000 2 455\\r\\n', 'output': ['0']}, {'input': '1 1000000000 250000000 1000000000\\r\\n', 'output': ['2']}, {'input': '3 3 1 1\\r\\n', 'output': ['0']}, {'input': '1 1000000000 100000000 1000000000\\r\\n', 'output': ['4']}, {'input': '5 10 3 3\\r\\n', 'output': ['0']}, {'input': '1 1000 5 13\\r\\n', 'output': ['0']}, {'input': '2 2 3 3\\r\\n', 'output': ['0']}, {'input': '1 1000000000 499999993 999999986\\r\\n', 'output': ['2']}, {'input': '1 1 1 10\\r\\n', 'output': ['0']}, {'input': '1 10 10 100\\r\\n', 'output': ['0']}, {'input': '1 1000 4 36\\r\\n', 'output': ['2']}, {'input': '1 1000000000 10000000 20000000\\r\\n', 'output': ['2']}, {'input': '100 100 5 5\\r\\n', 'output': ['0']}, {'input': '3 3 3 9\\r\\n', 'output': ['0']}, {'input': '36 200 24 144\\r\\n', 'output': ['2']}, {'input': '1 100 3 10\\r\\n', 'output': ['0']}]","id":32} {"description":"In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network\u00a0\u2014 for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one railway or one road always takes exactly one hour.A train and a bus leave town 1 at the same time. They both have the same destination, town n, and don't make any stops on the way (but they can wait in town n). The train can move only along railways and the bus can move only along roads.You've been asked to plan out routes for the vehicles; each route can use any road\/railway multiple times. One of the most important aspects to consider is safety\u00a0\u2014 in order to avoid accidents at railway crossings, the train and the bus must not arrive at the same town (except town n) simultaneously.Under these constraints, what is the minimum number of hours needed for both vehicles to reach town n (the maximum of arrival times of the bus and the train)? Note, that bus and train are not required to arrive to the town n at the same moment of time, but are allowed to do so.","input_specification":"The first line of the input contains two integers n and m (2\u2009\u2264\u2009n\u2009\u2264\u2009400, 0\u2009\u2264\u2009m\u2009\u2264\u2009n(n\u2009-\u20091)\u2009\/\u20092)\u00a0\u2014 the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1\u2009\u2264\u2009u,\u2009v\u2009\u2264\u2009n, u\u2009\u2260\u2009v). You may assume that there is at most one railway connecting any two towns.","output_specification":"Output one integer\u00a0\u2014 the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output \u2009-\u20091.","notes":"NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4.","sample_inputs":["4 2\n1 3\n3 4","4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4","5 5\n4 2\n3 5\n4 5\n5 1\n1 2"],"sample_outputs":["2","-1","3"],"src_uid":"fbfc333ad4b0a750f654a00be84aea67","lang_cluster":"C++","difficulty":1600,"human_solution":"#include\nusing namespace std;\nint a,b,c,d,e,j[401];\nvector v[401][2];\nvector ::iterator t;\nbool w[401][401];\npriority_queue > q;\npair p[1];\nint main(){\n\tios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);\n\tcin>>a>>b;\n\tfor(c=1; c<=b; c++){\n\t\tcin>>d>>e;\n\t\tv[d][0].push_back(e);\n\t\tv[e][0].push_back(d);\n\t\tw[d][e]=1;\n\t\tw[e][d]=1;\n\t}\n\tif(w[1][a]==1){\n\t\tfor(c=1; c<=a; c++){\n\t\t\tfor(d=1; d<=a; d++){\n\t\t\t\tif(c!=d&&w[c][d]==0) v[c][1].push_back(d),v[d][1].push_back(c);\n\t\t\t}\n\t\t}\n\t\tq.push(make_pair(0,1));\n\t\twhile(q.size()!=0){\n\t\t\tp[0]=q.top();\n\t\t\tq.pop();\n\t\t\tfor(t=v[p[0].second][1].begin(); t!=v[p[0].second][1].end(); t++){\n\t\t\t\tif((*t)==a){\n\t\t\t\t\tcout<-1*p[0].first+1||j[(*t)]==0){\n\t\t\t\t\tj[(*t)]=-1*p[0].first+1;\n\t\t\t\t\tq.push(make_pair(p[0].first-1,(*t)));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(q.size()==0){\n\t\t\t\tcout<<-1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\twhile(q.size()!=0&&j[q.top().second]-1*p[0].first+1||j[(*t)]==0){\n\t\t\t\t\tj[(*t)]=-1*p[0].first+1;\n\t\t\t\t\tq.push(make_pair(p[0].first-1,(*t)));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(q.size()==0){\n\t\t\t\tcout<<-1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\twhile(q.size()!=0&&j[q.top().second]\n#include\n#include\n#include\n#define maxn 200010\n#define INF 0x3f3f3f3f\n#define LL long long\nusing namespace std;\nint n,len;\nint a[maxn];\nLL sum[maxn];\nint main()\n{\n\tscanf(\"%d\",&n);\n\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tscanf(\"%d\",&a[i]);\n\t}\n\tif(n==2)\n\t{\n\t\tprintf(\"2\\n\");\n\t\tprintf(\"%d %d\",a[1],a[2]);\n\t\treturn 0;\n\t}\n\tsort(a+1,a+n+1);\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tsum[i]=sum[i-1]+a[i];\n\t}\n\tint res,ans1=1,len=0;\n\tdouble ans=-INF;\n\tfor(int i=1;i<=n;i++)\n\t{\n\t\tint l=1,r=min(i-1,n-i);\n\t\tres=0;\n\t\twhile(l<=r)\n\t\t{\n\t\t\tint mid=(l+r)\/2;\n\t\t\tdouble res1=1.0*(sum[i]-sum[i-mid-1]+sum[n]-sum[n-mid])\/(2*mid+1);\n\t\t\tdouble res2=1.0*(sum[i]-sum[i-mid]+sum[n]-sum[n-mid+1])\/(2*mid-1);\n\t\t\tif(res1>res2)\n\t\t\t\t{res=mid;l=mid+1;}\n\t\t\telse\n\t\t\t\tr=mid-1;\n\t\t\t\n\t\t}\n\t\tdouble tmp=1.0*(sum[i]-sum[i-res-1]+sum[n]-sum[n-res])\/(2*res+1)-a[i];\n\t\t\/\/printf(\"%.3lf %.3lf\\n\", tmp, ans);\n\t\tif(tmp>ans)\n\t\t\t{ans=tmp;ans1=i;len=res;}\n\t}\n\tprintf(\"%d\\n\",2*len+1);\n\tfor(int i=ans1-len;i<=ans1;i++)\n\t{\n\t\tprintf(\"%d \",a[i]);\n\t}\n\tfor(int i=n-len+1;i<=n;i++)\n\t{\n\t\tprintf(\"%d\",a[i]);\n\t\tif(i!=n)\n\t\tprintf(\" \");\n\t}\n}\n","testcases":"[{'input': '4\\r\\n1 2 3 12\\r\\n', 'output': ['3\\r\\n1 2 12 \\r\\n']}, {'input': '4\\r\\n1 1 2 2\\r\\n', 'output': ['3\\r\\n1 1 2 \\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['2\\r\\n1 2\\r\\n']}, {'input': '1\\r\\n1000000\\r\\n', 'output': ['1\\r\\n1000000 \\r\\n']}, {'input': '20\\r\\n999999 999998 999996 999992 999984 999968 999936 999872 999744 999488 998976 997952 995904 991808 983616 967232 934464 868928 737856 475712\\r\\n', 'output': ['1\\r\\n475712 \\r\\n']}, {'input': '21\\r\\n999999 999998 999996 999992 999984 999968 999936 999872 999744 999488 998976 997952 995904 991808 983616 967232 934464 868928 737856 475712 1000000\\r\\n', 'output': ['1\\r\\n475712 \\r\\n']}, {'input': '40\\r\\n999999 999999 999998 999998 999996 999996 999992 999992 999984 999984 999968 999968 999936 999936 999872 999872 999744 999744 999488 999488 998976 998976 997952 997952 995904 995904 991808 991808 983616 983616 967232 967232 934464 934464 868928 868928 737856 737856 475712 0\\r\\n', 'output': ['3\\r\\n737856 737856 999999 \\r\\n']}, {'input': '1\\r\\n534166\\r\\n', 'output': ['1\\r\\n534166 \\r\\n']}, {'input': '1\\r\\n412237\\r\\n', 'output': ['1\\r\\n412237 \\r\\n']}, {'input': '1\\r\\n253309\\r\\n', 'output': ['1\\r\\n253309 \\r\\n']}, {'input': '1\\r\\n94381\\r\\n', 'output': ['1\\r\\n94381 \\r\\n']}, {'input': '1\\r\\n935454\\r\\n', 'output': ['1\\r\\n935454 \\r\\n']}, {'input': '2\\r\\n847420 569122\\r\\n', 'output': ['2\\r\\n847420 569122\\r\\n']}, {'input': '2\\r\\n725491 635622\\r\\n', 'output': ['2\\r\\n725491 635622\\r\\n']}, {'input': '2\\r\\n566563 590441\\r\\n', 'output': ['2\\r\\n566563 590441\\r\\n']}, {'input': '2\\r\\n407635 619942\\r\\n', 'output': ['2\\r\\n407635 619942\\r\\n']}, {'input': '2\\r\\n248707 649443\\r\\n', 'output': ['2\\r\\n248707 649443\\r\\n']}, {'input': '3\\r\\n198356 154895 894059\\r\\n', 'output': ['3\\r\\n154895 198356 894059 \\r\\n']}, {'input': '3\\r\\n76427 184396 963319\\r\\n', 'output': ['3\\r\\n76427 184396 963319 \\r\\n']}, {'input': '3\\r\\n880502 176898 958582\\r\\n', 'output': ['1\\r\\n176898 \\r\\n']}, {'input': '3\\r\\n758573 206400 991528\\r\\n', 'output': ['1\\r\\n206400 \\r\\n']}, {'input': '3\\r\\n599645 198217 986791\\r\\n', 'output': ['1\\r\\n198217 \\r\\n']}, {'input': '4\\r\\n549294 703669 96824 126683\\r\\n', 'output': ['3\\r\\n96824 126683 703669 \\r\\n']}, {'input': '4\\r\\n390366 733171 92086 595244\\r\\n', 'output': ['3\\r\\n92086 390366 733171 \\r\\n']}, {'input': '4\\r\\n231438 762672 125033 26806\\r\\n', 'output': ['3\\r\\n26806 125033 762672 \\r\\n']}, {'input': '4\\r\\n109509 792173 120296 495368\\r\\n', 'output': ['3\\r\\n109509 120296 792173 \\r\\n']}, {'input': '4\\r\\n950582 784676 190241 964614\\r\\n', 'output': ['1\\r\\n190241 \\r\\n']}, {'input': '5\\r\\n900232 289442 225592 622868 113587\\r\\n', 'output': ['3\\r\\n113587 225592 900232 \\r\\n']}, {'input': '5\\r\\n741304 281944 258539 54430 284591\\r\\n', 'output': ['3\\r\\n281944 284591 741304 \\r\\n']}, {'input': '5\\r\\n582376 311446 253801 560676 530279\\r\\n', 'output': ['3\\r\\n253801 311446 582376 \\r\\n']}, {'input': '5\\r\\n460447 303948 286063 992238 738282\\r\\n', 'output': ['3\\r\\n286063 303948 992238 \\r\\n']}, {'input': '5\\r\\n301519 370449 319010 460799 983970\\r\\n', 'output': ['3\\r\\n301519 319010 983970 \\r\\n']}, {'input': '21\\r\\n999999 999998 999996 999992 999984 999968 999936 999872 999744 999488 998976 997952 995904 991808 983616 967232 934464 868928 737856 475712 999998\\r\\n', 'output': ['3\\r\\n999998 999998 999999 \\r\\n']}]","id":34} {"description":"There are n students in a class working on group projects. The students will divide into groups (some students may be in groups alone), work on their independent pieces, and then discuss the results together. It takes the i-th student ai minutes to finish his\/her independent piece.If students work at different paces, it can be frustrating for the faster students and stressful for the slower ones. In particular, the imbalance of a group is defined as the maximum ai in the group minus the minimum ai in the group. Note that a group containing a single student has an imbalance of 0. How many ways are there for the students to divide into groups so that the total imbalance of all groups is at most k?Two divisions are considered distinct if there exists a pair of students who work in the same group in one division but different groups in the other.","input_specification":"The first line contains two space-separated integers n and k (1\u2009\u2264\u2009n\u2009\u2264\u2009200, 0\u2009\u2264\u2009k\u2009\u2264\u20091000)\u00a0\u2014 the number of students and the maximum total imbalance allowed, respectively. The second line contains n space-separated integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009500)\u00a0\u2014 the time it takes the i-th student to complete his\/her independent piece of work.","output_specification":"Print a single integer, the number of ways the students can form groups. As the answer may be large, print its value modulo 109\u2009+\u20097.","notes":"NoteIn the first sample, we have three options: The first and second students form a group, and the third student forms a group. Total imbalance is 2\u2009+\u20090\u2009=\u20092. The first student forms a group, and the second and third students form a group. Total imbalance is 0\u2009+\u20091\u2009=\u20091. All three students form their own groups. Total imbalance is 0. In the third sample, the total imbalance must be 0, so each student must work individually.","sample_inputs":["3 2\n2 4 5","4 3\n7 8 9 10","4 0\n5 10 20 21"],"sample_outputs":["3","13","1"],"src_uid":"788cb3da98fd4a56720f800588061b79","lang_cluster":"C++","difficulty":2400,"human_solution":"#include\nusing namespace std;\nconst long long mod=1e9+7;\nint n,k,now,a[205];\nlong long f[2][205][1010],ans;\nint read()\n{\n\tint res=0,fl=0;\n\tchar a=getchar();\n\twhile(a<'0'||a>'9') {if(a=='-') fl=1;a=getchar();}\n\twhile(a>='0'&&a<='9') res=res*10+a-'0',a=getchar();\n\treturn fl? -res:res;\n}\nint main()\n{\n\/\/\tfreopen(\"group.in\",\"r\",stdin);\n\/\/\tfreopen(\"group.out\",\"w\",stdout);\n\tint i,j,li;\n\tn=read(),k=read();\n\tfor(i=1;i<=n;i++) a[i]=read();\n\tsort(a+1,a+n+1),f[0][0][0]=1;\n\tfor(i=0;ik) continue;\n\t\t\t\t(f[now^1][j][li+t]+=f[now][j][li]*(j+1)%mod)%=mod;\n\t\t\t\t(f[now^1][j+1][li+t]+=f[now][j][li])%=mod;\n\t\t\t\tif(j) (f[now^1][j-1][li+t]+=f[now][j][li]*j%mod)%=mod;\n\t\t\t}\n\t\tmemset(f[now],0,sizeof(f[now])),now^=1;\n\t}\n\tfor(i=0;i<=k;i++) (ans+=f[now][0][i])%=mod;\n\tcout<\r\n#include \r\n#define int long long\r\n#define ll long long\r\n#define ull unsigned long long\r\n#define i128 __int128\r\n#define ld long double\r\n#define rep(i,n) for(int i=0;i=b;i--)\r\n#define sz(s) (int)s.size()\r\n#define all(v) v.begin(),v.end()\r\n#define itr_ iterator\r\n#define p_b push_back\r\n#define pii pair\r\n#define pll pair\r\n#define fr first\r\n#define sc second\r\n#define m_p make_pair\r\n#define debug(x) cout<<#x<<\":\"<>x>>k>>p;\r\n\tp\/=100;\r\n\tfor(int i=0;i<=k;i++){\r\n\t\tfor(int j=x+i;!(j&1);j>>=1)\r\n\t\t\tf[0][i]++;\r\n\t}\r\n\tfor(int i=0;i \n#include \n#include \n#include \n#include \n#include \n#include \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#define REP(i,b,n) for(int i=b;i void vp(T &a,int p){rep(i,p)cout << a[i]<<\" \";cout << endl;} \ntypedef complexP; \ntypedef long long ll; \ntypedef unsigned long long ull; \ntypedef pair pii; \nconst int N = 22;\nconst int M = N*N+10;\nconst double eps = 1e-10;\nvector edge[N];\nbool e[N][N];\ndouble ori[M][M];\n\n\/\/n matrix size a00+x0+...=c0\n\/\/k current step\n\/\/mat Matrix\nbool select_pivot(int n,int k,double mat[M][M]){\n int s=k;\/\/selected pivot\n double val=fabs(mat[k][k]);\n REP(i,k+1,n)if (fabs(mat[i][k]) >val)val=fabs(mat[i][k]),s=i;\n if (val=0;i--){\/\/solve ith row\n REP(j,i+1,n){\n mat[i][n]-=mat[i][j]*mat[j][n];\n }\n }\n return true;\n}\n\n\nmain(){\n int n,m,a,b;\n double mat[M][M];\n while(cin>>n>>m>>a>>b){\n a--;b--;\n rep(i,n){\n rep(j,n)e[i][j]=false;\n e[i][i]=true;\n edge[i].clear();\n }\n rep(i,m){\n int f,t;cin>>f>>t;f--;t--;edge[f].pb(t);edge[t].pb(f);\n e[f][t]=e[t][f]=true;\n }\n double st[n],move[n];\n rep(i,n)cin>>st[i],move[i]=(1-st[i])\/edge[i].size();\n int size=n*n;\n rep(i,size)rep(j,size)mat[i][j]=0;\n\n rep(i,n){\/\/first player is on i,\n rep(j,n){\/\/first player is on j\n\t\/\/(i,j) -> (k,l)\n\tint pos1 = i*n+j;\n\t\/\/if (i == j){continue;}\n\tmat[pos1][pos1]-=1;\n\trep(k,n){\n\t if (!e[i][k])continue;\n\t double p1 = i==k ?st[k]:move[k];\n\t rep(l,n){\n\t if (!e[j][l])continue;\n\t if (k == l)continue;\n\t int pos2=k*n+l;\n\t double p2 = j==l ?st[l]:move[l];\n\t mat[pos1][pos2]+=p1*p2;\n\t }\n\t}\n }\n }\n mat[a*n+b][size]=-1;\n \/\/if (n <= 3)rep(i,size)rep(j,size+1)printf(\"%.5lf%c\",mat[i][j],j==size?'\\n':' ');\n gauss(size,mat);\n \/\/if (n <= 3)rep(i,size)rep(j,size+1)printf(\"%.5lf%c\",mat[i][j],j==size?'\\n':' ');\n\n for(int i=0;i\n#include \n#include \n#include \n\nusing namespace std;\n\nstring s;\nint cnt1[11], cnt2[11], res1[100005], res2[100005];\n\nint main() {\n cin>>s;\n for(int i= 0;i res) {\n res = numZeroes;\n cntZero = x;\n t1 = i;\n t2 = j;\n }\n ++cnt1[i];\n ++cnt2[j];\n }\n }\n cnt1[0] += x;\n cnt2[0] += x;\n }\n if(t1 == -1 && t2 == -1) {\n sort(s.begin(),s.end());\n reverse(s.begin(),s.end());\n cout<=0;--i)\n printf(\"%d\",res1[i]);\n printf(\"\\n\");\n for(int i = s.size()-1;i>=0;--i)\n printf(\"%d\",res2[i]);\n printf(\"\\n\");\n\n return 0;\n}\n","testcases":"[{'input': '198\\r\\n', 'output': ['981\\r\\n819']}, {'input': '500\\r\\n', 'output': ['500\\r\\n500']}, {'input': '1061\\r\\n', 'output': ['1160\\r\\n1160', '6110\\r\\n6110']}, {'input': '1099\\r\\n', 'output': ['9901\\r\\n1099']}, {'input': '4877\\r\\n', 'output': ['4778\\r\\n4778', '8774\\r\\n8774']}, {'input': '787027\\r\\n', 'output': ['877720\\r\\n777280']}, {'input': '7665711\\r\\n', 'output': ['7766115\\r\\n7766115']}, {'input': '670042\\r\\n', 'output': ['672400\\r\\n427600']}, {'input': '87417\\r\\n', 'output': ['77481\\r\\n77418', '87741\\r\\n87741', '14778\\r\\n14778']}, {'input': '27183007\\r\\n', 'output': ['78721300\\r\\n31278700']}, {'input': '2603340571199714716025114079373828413509944752618962350632892540710372640383149198328312562980217104434880337288055817064\\r\\n', 'output': ['9444433333332219999999998888888888888777777777776666666655555555544444444433333333222222222221111111111111000000000100000\\r\\n4444333333322110000000001111111111111222222222223333333344444444455555555566666666777777777778888888888888999999999900000', '4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\\r\\n4444333333322110000000000111111111111122222222222333333334444444445555555556666666677777777777888888888888899999999990000']}, {'input': '8679647744\\r\\n', 'output': ['9877766444\\r\\n9877764446']}, {'input': '220737406285\\r\\n', 'output': ['877654322200\\r\\n222345677800']}, {'input': '993522733475817\\r\\n', 'output': ['997533877542213\\r\\n995333122457787']}, {'input': '5057017252180797906185\\r\\n', 'output': ['7765551998877221100500\\r\\n7765551001122778899500']}, {'input': '12414711447744142772\\r\\n', 'output': ['11111222444444477777\\r\\n11111222444444477777', '77444444411111777222\\r\\n77444444411111222777', '77777444444422211111\\r\\n77777444444422211111']}, {'input': '3037225037514100860827276704\\r\\n', 'output': ['7887777665544332222113000000\\r\\n3112222334455667777887000000']}, {'input': '346762409573609367635944363650432097309\\r\\n', 'output': ['774499999776666666555444333333322000003\\r\\n744300000223333333444555666666677999997']}, {'input': '21504009080570645002760268009722803470954749000131\\r\\n', 'output': ['69999888777776655554444332222211100004000000000000\\r\\n40000111222223344445555667777788899996000000000000']}, {'input': '3311314413231141411421432122343321141133112122342341334443214\\r\\n', 'output': ['4444444444444433333333333333332222222222211111111111111111111\\r\\n4444444444444433333333333333332222222222211111111111111111111', '1111111111111111111122222222222333333333333333344444444444444\\r\\n1111111111111111111122222222222333333333333333344444444444444']}, {'input': '9070901003919040000887091134838800004472724709967020097067025050205000220352709096100405900207957128\\r\\n', 'output': ['7999999999999888888777777777766655555544444433322222222221111110000000000003000000000000000000000000\\r\\n3000000000000111111222222222233344444455555566677777777778888889999999999997000000000000000000000000']}, {'input': '41818138314831348134448848318148131818813388313344833114141141184383813143343448843131343384181384844431384114113314313144848133488818418384818848341344811441811141313448341888341118488811314338434488\\r\\n', 'output': ['88888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111\\r\\n88888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111', '11111111111111111111111111111111111111111111111111111133333333333333333333333333333333333333333333344444444444444444444444444444444444444444444444444888888888888888888888888888888888888888888888888888\\r\\n11111111111111111111111111111111111111111111111111111...', '44444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111888888888888888888888888888888888888888888888888888111111111111111111111111111111111111111111111111111\\r\\n44444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111888888888888888888888888888888888888888888888888888']}, {'input': '73552900025351606679224588872327647961330089042655630665222580520508672870102563487600132539752481214659858863022476410484266570139810532470714984092503934751571221521306943121997450187110428026190962582430971693370613087381790614697689671767000004095232276975952292053272119035138483846537407714434012224979098527763281110363860729062927455745190194649\\r\\n', 'output': ['66655222222221111111199999999999999999999999999999999988888888888888888888888888877777777777777777777777777777777777776666666666666666666666666666666555555555555555555555555555555544444444444444444444444444444443333333333333333333333333333333222222222222222222222222222222222222211111111111111111111111111100000000000000000000000000000000050000000000000\\r\\n666552222222211111111000000000000000000000000000000000111111111111111111111111111222222222222222222222222222222222222233333333333333333333333333333334444444...']}, {'input': '3660060360865606405406648718470765048005409506710925001850101061700007022407913434780234609002664580600302035550131007145010003815754853838580300966004029000300434981894159106340481587649046330570701648116012056320463003313141680800500509429100191307403765300801130020535489060555504004005803272823494700970010952879008030098004480465890588039380501581078422931611654908930340540303783403661632050700948101050151020160623940430284004280902060684751066629489507855752580027410505650019760020009138500203642800308...', 'output': ['8999999999999999999999999999999999888888888888888888888888888888888888888888888888888777777777777777777777777777777777666666666666666666666666666666666666666666666666666665555555555555555555555555555555555555555555555555555555554444444444444444444444444444444444444444444444444444444443333333333333333333333333333333333333333333333333333322222222222222222222222222222222211111111111111111111111111111111111111111111111111100000000000000000000000000000000020000000000000000000000000000000000000000000000000000000...']}, {'input': '3988405032201869838583516133943649897563464963199720203573666195109254972807095125585153139107836315540802254503122202208671231062969287785325745149827780975637820846694844717512181082423246460831153198676512327424647704185170864814344819230405434252307112870463387306341417126663194715993207482864102823774828380347931676663905538788367741598351252166769604140992179418820043419699163449596439979329298654494702555801641339987965927031928141345579024032222443566448480995335779507500358684011237604341216194860...', 'output': ['9999999999999644444444444444444422211111111111999999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777777777776666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555554444444444444444444444444444444444444444444444444444444444444444444444433333333333333333333333333333...']}, {'input': '5562193853810918945620627929172131555837473643554362967763887812413927487628705169826152884386226149418373951049986250969308862515359891001338285242920050910490906828048000561263856034031835539717283086698037020184346364592477218030068494838985393388772969774556866175869082513319040937289891361048143148841837267534830052901494206187747905771299059141380597767985198813756458221849136120811572042106826621666519843756406853641666119992871613251441378811527654575794639431472815236597945545443592839760099142175...', 'output': ['9999999999999999999999977777777777777555555999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777666666666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555555555544444444444444444444444444444444444444444444444444444444444444444444444444443333333333333333333333333...']}, {'input': '1730422676082588834860375440897683748061653034160089035356410303853087273043400007064082808873506818021832173796672909286031070430706710420988411005000807994008004024283001700960690091562564065800969314020467274006854259128883092106143502490180340506154995307707013371796800069059205904006180070480509165819304195087071960902368005201049042530842923912727019572672086010287001109827122078050756623098907147400115030307257820452003056013088910107770590352130772036869022135230000406249627027600081343058909708407...', 'output': ['7999999999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777777777777777777777777666666666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555555554444444444444444444444444444444444444444444444444444444444444444444444444433333333333333333333333333333333333...']}, {'input': '1188618183388611381111868863636138313333318818183316831361113811386318881168331361688618161613168636818383186336633113388318838136613388313111138111638188133138611181663863163386311813118638838866886113361631311686863836336863366813363683838881686613163833833813818131863311861368333636631363361331668363336363133666111611188181133381186813313311188138316336861381168838138611618113313831613331631133161186833631636661616388613133631666888311386383811818886633183161338681333381366386313631818363861111388386336...', 'output': ['3333333333333333333333333333333333333333111188888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666...', '8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888866666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666333333333333333333333333333333333...']}, {'input': '4243694432732244021095331595848137532367241195639191582163152600248271436184171538206044964067675106064159822875846011534297438582909683899088886549812421326048203391195680776887732457754143569028983164195293260537822023061273285507094731086855967279325960871356767018241344379707565856468765648033087664400397093527921657664579022705211823347324199918200113662278819911280201671779336001809547757878558876551737537928583698853638809689051510513192892880892879923602951533842587693618320930509403954665244464014...', 'output': ['9988888884433229999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555554444...']}, {'input': '5437214130838098132393123187069383986299021704931433096622499682915037838279737829812626065978576360754157333866084773073470536769353978446234788082062466105585127249713791721276273253638073234535447123880003542275055023902223874569552201863700202729293434430147174682302760783914011412039339697895841967107362265388874914846141521997037412954401235418335972353607055044874973461347888021255272429429744517830123078766552437060613565467908259410563840960055743267873948181932990399762986852911078878324107938917...', 'output': ['8888888888888888888888888886666666666666644444444444444444444444444444444444444444444449999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888777777777777777777...']}, {'input': '4944847984484499897477888998874784884474797788999888498989748984997797774478988749487787787944998784444748977844777488984798748984848479947894989998987487879949447848848898888479487898778984788988844874979497894779489449989797494497448984798494794487487499897944798844794498988947898787974874948989778778787978779999884994978894997949747744747987949784774894974798444899479997779484979789977489799448894478894447988489844888844979484789849479784487487984494474787484798944879774787979844984474989994948844498848...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '7688754930503622624249376302050721830065980218099156664541044701341628003496939103577693880283583449467297533469375121979331361424629165453875685841427085813980899970901793449283121463702841677303321796810682892574801165017961242552369171251649136915268463307740719648716991029731139504104601780245826323470355102044393062687794743810560411082474390672510942974815216433066730925915777989481449608904036597675354340429734413866576289385161415247796862427872213476834038054015404274700559772991390769430573604588...', 'output': ['7777777777777777777777777777777777777777777777777777744444333333333333333333333333333333333333311111111111111111111111111111199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6185037014707879384301592707009200430885687987529770162683115103088000085680865822274850080279809974072320607292351515828318654276346545329009080458123889570600021478058963049335300526437402130814087220633083010320092359393947423676191603547547874099010090263715163042641015092023212068194008006284379105933507405589730536098173006808291862017372694644277904949390565867842170703665006250410053210368067399451324395605280164900094231101070015087506700869427482073857397072913460003007919234200185280014042400788...', 'output': ['0999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', '9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '9965675082563929077799639762147786621291924398160624989369600320192031503878569896057485302667512360792029743474568614205998702183738012739853871916032407255123289056032335037954093166786819460498686316030169623643193583487898113843927174667792205951098904610616262292296460934603477941718344667867924960280476601880750505510840781238530728533026536005269229659829632892079936763214347808150429912908943447565716781168693866762946019658346001623995714859531084238467607308795481083815672444891116656361208045970...', 'output': ['7777777777777777777777766666666666666666666666666666666666666666666666666666664444111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '9399099847230403397608550745456155491158833773727348957376326513008223271678368456249540347230059416611594526577303833136258789778891864775273632464015119183546285134805758447349338707895134660480829159525233548918538910475304570679493939658220667016376015440024476591414811967116176614232543688298600080829981632901950723372865951651419680198089502103871677882895994538059569016616295154550051663786468623844991852957332803481973612908697320851672235286727280608094255910265465949153761572434331191352427728064...', 'output': ['7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777666666666666666444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444441111111111111111111111111111111111111111111111111111111111111999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '8677967897698796789869977698966986766668767667877789687666777969877868866999778969776786886687667966666886998976666676977779778769966697999998779777897676767686769769786987879887997776899999678878889896989896786778987668667889996989798796789766787977696988889666979897677886999868886976889987967696786768799888977677869978788766888766766967966876677799699997999866877688987986667899667687969687976867888778966777679767976979686899989799966976677796988888678867987797979987688869998677678689766966799667798866777...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '9169971377710854296307256878741743698904124875448188271438951731205465267096367879254423883111502855461268175261428259841277349539147022226480518218151857953676017222027859200956811168178482461083232476828773371751606247028165410567693365659977753752229668485142842096080257823565015585554974200804379221344492030870542627558563729072598095907764908903382419976933178549658032518931968565924190202313496291962510432634753675507873015068004621111683336737250908340689201372884809217551652679954580369879266423996...', 'output': ['6999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6402786117688907443629724676831861533380180662220326080501780992805834946738488906845349427183566546511120382042723532624475030689025499486454271766674879981315283125798751257569414757976374038693161455471776288448466249042222232425875808224403027744003704733955856398480964728375104262593788637777991997226599166814909071700171931478113019658198262741949705020331053974720755616818262843218961549805697021892940521399666343560867144526146538816131915538024059710094503485967378568082586947837283236875658146083...', 'output': ['6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666664444444444444444444444444444444444444444444444444444444444444444444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211111111111111111111111111111111111111111111111111111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '2070584715958145931421943242877190736958188253532149113773257317774198852654268041861390688937915459566813326558023375873717875659623285221404908938186814771148690466010226989170254197736185741906851849474335844294393346935985196002604635838488633689366270270816465659353721056863151769188355135996953267698927714458440941550608272933473999407843409218797782406542610740951897694088643421505259321077956931953401390506157198305673803989694229999834828559332611372520954127118391729272331426793792414035235978292...', 'output': ['6666644444444444444444444444222222222222222222222222221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '8830861889084051137643095774667654091986146869638648806288355834264695705797997204636152837277104079861551043640411014476918595066178670622283784697836347266655410475651455424263984398400662652738282678568304261152268090472444853374162421538590461473160139331604155280883012526754572269223633721300073239964775068679107842867167988931514560036166077584920827099541095153530279147684552577281385808157457305366848324391930843148351467387609038643560823897910018058987387476315080167238324082347653316905346938679...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777666666666666666666666666666666666666666666666666666666666666666666666666666444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444411199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '8305353302042045132812713478589540940020097002309955880051290302345538886542504324100015141590915418707137647116069301978829579921838244596449533937725450722688600320224550552507030093558787751655874747352271037965806257211323568094024519907197752098052106271348046013549239460290417613713576981256525956964865075252410470149725070078486001965401206111081063737511835054192700776299150006487937152257808653940563700849221029782962584151954350056927572215246004027016540143697744783917148900624067210069508161787...', 'output': ['8999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6704583818391588725469181550354102907239957098358358841717401300766278881560400090038110916014289948657235584423606594158621824161523469830236380607965385255791396338932174225438170797034425037147862456636103346837327265294351641494623753674273621107344771242622310334986605935646991773638608552637622046669634226820615541845784212711291886281633637512336684846321599254977042239750805332860293274970565739990902560439745089146186062321750856522530810958656665834465619613523446131577586425662419972532205004271...', 'output': ['4444444444444444444444444444444444444444444444444444443333333333333333333333333333333333333333333333333333333333333333333333333333332222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111099999999999999999999999999999999999999999...', '9444444444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333333333333333333333333333333333333222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111199999999999999999999999999999999999999999...']}, {'input': '9689938698889663898863839636966699683986893699339386968338899966338869996936888869663833336868866886386686639839963333996866369633899638368886998389968998699366836388883663893393688389893963669968369396688338969698386338398836839988388898698688996366986968989699663989989698666833338689688393939988989389688683933989888969993363986386998399368636639933366866638686886936996998988399363868338933366966866996963866669896888669699698386869968968863868939688838383896969669866999369969399938388639699888886838393936...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6023899695120557896013140711187680503448138679874588624050077803801854865697769353263222770960826861606106727886113310607069728272963227255389496899919068931344113537068309946879921059042444576366749994436144274847702102456819164989911861327124734838196173853563309843214631874712516961632171049329502507717957033924841978867659693226643101620967990111518453074600938886866941984226547980772170089838147109088768785941748600078140887848218226465026331411736734765922485300427498987217333097493592537246554457873...', 'output': ['9999999999999999999999888888888888888888888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333332222222222222222222222222222222222222222222222222222222222222229999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '404\\r\\n', 'output': ['440\\r\\n440']}, {'input': '545\\r\\n', 'output': ['545\\r\\n455']}, {'input': '9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909...', 'output': ['5999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '1486913458965407214474383051348880508797108309397132594608042047940314727604051381139181936657952113296264075630972575614980513092531236791260521858939901778974029659858701463047070106689549279462422735787009718900006205995325189656713599230841667711463676680976775990350526357505751432136802865972492235528750512640736169514063847705640465671951212885515298612577866350659145039585877518710392780320811778565480073883045746578885361310463306158402059382132691444825799882582584615455011180820034013186375611788...', 'output': ['9999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888777777777777777777777777777777777766666666666666666666666666666666666666664444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444449999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '735529000253516066792245888723276479613300890426556306652225805205086728701025634876001325397524812146598588630224764104842665701398105324707149840925039347515712215213069431219974501871104280261909625824309716933706130873817906146976896717670000040952322...', 'output': ['666552222222211111111999999999999999999999999999999999888888888888888888888888888777777777777777777777777777777777777766666666666666666666666666666665555555555555555555555555555555444444444444444444444444444444433333333333333333333333333333332222222222222...']}, {'input': '366006036086560640540664871847076504800540950671092500185010106170000702240791343478023460900266458060030203555013100714501000381575485383858030096600402900030043498189415910634048158764904633057070164811601205632046300331314168080050050942910019130740376...', 'output': ['899999999999999999999999999999999988888888888888888888888888888888888888888888888888877777777777777777777777777777777766666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555444444444444444444444444444...']}, {'input': '398840503220186983858351613394364989756346496319972020357366619510925497280709512558515313910783631554080225450312220220867123106296928778532574514982778097563782084669484471751218108242324646083115319867651232742464770418517086481434481923040543425230711...', 'output': ['999999999999964444444444444444442221111111111199999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777...']}, {'input': '556219385381091894562062792917213155583747364355436296776388781241392748762870516982615288438622614941837395104998625096930886251535989100133828524292005091049090682804800056126385603403183553971728308669803702018434636459247721803006849483898539338877296...', 'output': ['999999999999999999999997777777777777755555599999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777766...']}, {'input': '173042267608258883486037544089768374806165303416008903535641030385308727304340000706408280887350681802183217379667290928603107043070671042098841100500080799400800402428300170096069009156256406580096931402046727400685425912888309210614350249018034050615499...', 'output': ['799999999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666...']}, {'input': '118861818338861138111186886363613831333331881818331683136111381138631888116833136168861816161316863681838318633663311338831883813661338831311113811163818813313861118166386316338631181311863883886688611336163131168686383633686336681336368383888168661316383...', 'output': ['111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '424369443273224402109533159584813753236724119563919158216315260024827143618417153820604496406767510606415982287584601153429743858290968389908888654981242132604820339119568077688773245775414356902898316419529326053782202306127328550709473108685596727932596...', 'output': ['998888888443322999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777...']}, {'input': '543721413083809813239312318706938398629902170493143309662249968291503783827973782981262606597857636075415733386608477307347053676935397844623478808206246610558512724971379172127627325363807323453544712388000354227505502390222387456955220186370020272929343...', 'output': ['888888888888888888888888888666666666666664444444444444444444444444444444444444444444444999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '494484798448449989747788899887478488447479778899988849898974898499779777447898874948778778794499878444474897784477748898479874898484847994789498999898748787994944784884889888847948789877898478898884487497949789477948944998979749449744898479849479448748749...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '768875493050362262424937630205072183006598021809915666454104470134162800349693910357769388028358344946729753346937512197933136142462916545387568584142708581398089997090179344928312146370284167730332179681068289257480116501796124255236917125164913691526846...', 'output': ['777777777777777777777777777777777777777777777777777774444433333333333333333333333333333333333331111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '618503701470787938430159270700920043088568798752977016268311510308800008568086582227485008027980997407232060729235151582831865427634654532900908045812388957060002147805896304933530052643740213081408722063308301032009235939394742367619160354754787409901009...', 'output': ['099999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '996567508256392907779963976214778662129192439816062498936960032019203150387856989605748530266751236079202974347456861420599870218373801273985387191603240725512328905603233503795409316678681946049868631603016962364319358348789811384392717466779220595109890...', 'output': ['777777777777777777777776666666666666666666666666666666666666666666666666666666444411111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '939909984723040339760855074545615549115883377372734895737632651300822327167836845624954034723005941661159452657730383313625878977889186477527363246401511918354628513480575844734933870789513466048082915952523354891853891047530457067949393965822066701637601...', 'output': ['777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666666666644444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444111111111111111111111111111111111...']}, {'input': '867796789769879678986997769896698676666876766787778968766677796987786886699977896977678688668766796666688699897666667697777977876996669799999877977789767676768676976978698787988799777689999967887888989698989678677898766866788999698979879678976678797769698...', 'output': ['666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666...']}, {'input': '916997137771085429630725687874174369890412487544818827143895173120546526709636787925442388311150285546126817526142825984127734953914702222648051821815185795367601722202785920095681116817848246108323247682877337175160624702816541056769336565997775375222966...', 'output': ['699999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '640278611768890744362972467683186153338018066222032608050178099280583494673848890684534942718356654651112038204272353262447503068902549948645427176667487998131528312579875125756941475797637403869316145547177628844846624904222223242587580822440302774400370...', 'output': ['666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666444444444444444444444444444444444444444444444444444444444444444444444444442222222222222222222222222222222222...']}, {'input': '207058471595814593142194324287719073695818825353214911377325731777419885265426804186139068893791545956681332655802337587371787565962328522140490893818681477114869046601022698917025419773618574190685184947433584429439334693598519600260463583848863368936627...', 'output': ['666664444444444444444444444422222222222222222222222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '883086188908405113764309577466765409198614686963864880628835583426469570579799720463615283727710407986155104364041101447691859506617867062228378469783634726665541047565145542426398439840066265273828267856830426115226809047244485337416242153859046147316013...', 'output': ['999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666666666666666666666666666666666666666666666666666666666666...']}, {'input': '830535330204204513281271347858954094002009700230995588005129030234553888654250432410001514159091541870713764711606930197882957992183824459644953393772545072268860032022455055250703009355878775165587474735227103796580625721132356809402451990719775209805210...', 'output': ['899999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '670458381839158872546918155035410290723995709835835884171740130076627888156040009003811091601428994865723558442360659415862182416152346983023638060796538525579139633893217422543817079703442503714786245663610334683732726529435164149462375367427362110734477...', 'output': ['444444444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333333333333333333333333333333333333222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211...']}, {'input': '968993869888966389886383963696669968398689369933938696833889996633886999693688886966383333686886688638668663983996333399686636963389963836888699838996899869936683638888366389339368838989396366996836939668833896969838633839883683998838889869868899636698696...', 'output': ['333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333...']}, {'input': '602389969512055789601314071118768050344813867987458862405007780380185486569776935326322277096082686160610672788611331060706972827296322725538949689991906893134411353706830994687992105904244457636674999443614427484770210245681916498991186132712473483819617...', 'output': ['999999999999999999999988888888888888888888888888888888888888888888888888888888888888888884444444444444444444444444444444444444444444444444444444444444444444444444433333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333...']}, {'input': '909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909...', 'output': ['599999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '126254092095959027850416433832655426981078106611255074552648515499659121878087190358961591096171231715312122879634738062251247629492483043125748065235158236635181790420183641430917548189219521011748435487445986824532619160561716073648857875108255827252014...', 'output': ['888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888884444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}]","id":38} {"description":"Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters \"a\", \"e\", \"i\", \"o\", \"u\" are considered vowels.Two lines rhyme if their suffixes that start from the k-th vowels (counting from the end) match. If a line has less than k vowels, then such line can't rhyme with any other line. For example, if k\u2009=\u20091, lines commit and hermit rhyme (the corresponding suffixes equal it), and if k\u2009=\u20092, they do not rhyme (ommit\u2009\u2260\u2009ermit).Today on a literature lesson Vera learned that quatrains can contain four different schemes of rhymes, namely the following ones (the same letters stand for rhyming lines): Clerihew (aabb); Alternating (abab); Enclosed (abba). If all lines of a quatrain pairwise rhyme, then the quatrain can belong to any rhyme scheme (this situation is represented by aaaa).If all quatrains of a poem belong to the same rhyme scheme, then we can assume that the whole poem belongs to this rhyme scheme. If in each quatrain all lines pairwise rhyme, then the rhyme scheme of the poem is aaaa. Let us note that it doesn't matter whether lines from different quatrains rhyme with each other or not. In other words, it is possible that different quatrains aren't connected by a rhyme.Vera got a long poem as a home task. The girl has to analyse it and find the poem rhyme scheme. Help Vera cope with the task.","input_specification":"The first line contains two integers n and k (1\u2009\u2264\u2009n\u2009\u2264\u20092500, 1\u2009\u2264\u2009k\u2009\u2264\u20095)\u00a0\u2014 the number of quatrains in the poem and the vowel's number, correspondingly. Next 4n lines contain the poem. Each line is not empty and only consists of small Latin letters. The total length of the lines does not exceed 104. If we assume that the lines are numbered starting from 1, then the first quatrain contains lines number 1, 2, 3, 4; the second one contains lines number 5, 6, 7, 8; and so on.","output_specification":"Print the rhyme scheme of the poem as \"aabb\", \"abab\", \"abba\", \"aaaa\"; or \"NO\" if the poem does not belong to any of the above mentioned schemes.","notes":"NoteIn the last sample both quatrains have rhymes but finding the common scheme is impossible, so the answer is \"NO\".","sample_inputs":["1 1\nday\nmay\nsun\nfun","1 1\nday\nmay\ngray\nway","2 1\na\na\na\na\na\na\ne\ne","2 1\nday\nmay\nsun\nfun\ntest\nhill\nfest\nthrill"],"sample_outputs":["aabb","aaaa","aabb","NO"],"src_uid":"a17bac596b1f060209534cbffdf0f40e","lang_cluster":"C++","difficulty":1600,"human_solution":"\/\/In The Name Of God ( Of programming )\n\n#include \n\nusing namespace std;\n\ntypedef long long ll;\ntypedef long double ld;\n\nconst ll Maxn = 1e5 + 7;\nconst ll Max = 1e3 + 7;\nconst ll Mod = 1e9 + 7;\nconst ll Inf = 1e9 + 7;\n\n#define pb push_back\n#define mp make_pair\n#define F first\n#define S second\n#define P_ll pair\n#define P_cl pair\n#define P_lc pair\n#define Sort( a ) sort ( a.begin(), a.end() )\n#define help_me_God ios_base::sync_with_stdio ( false )\n\nstring s[Maxn], V[Maxn];\nll ans[5];\n\nll check ( char t )\n{\n if ( t == 'u' || t == 'o' || t == 'a' || t == 'i' || t == 'e' )\n return true;\n return false;\n}\n\nvoid f ( ll a, ll b, ll c, ll d )\n{\n if ( V[a] == V[b] && V[c] == V[d] );\n else ans[1] = 0;\n if ( V[a] == V[c] && V[b] == V[d] );\n else ans[2] = 0;\n if ( V[a] == V[d] && V[c] == V[b] );\n else ans[3] = 0;\n if ( V[a] == V[b] && V[c] == V[d] && V[c] == V[b] );\n else ans[4] = 0;\n}\n\nvoid print ( ll i )\n{\n if ( i == 1 )\n cout << \"aabb\" << endl;\n if ( i == 2 )\n cout << \"abab\" << endl;\n if ( i == 3 )\n cout << \"abba\" << endl;\n if ( i == 4 )\n cout << \"aaaa\" << endl;\n}\n\nint main()\n{\n ll n, k;\n cin >> n >> k;\n for ( ll i = 1; i <= 4 * n; i++ )\n {\n cin >> s[i];\n ll K = k;\n for ( ll j = s[i].size() - 1; K && j >= 0; j-- )\n {\n V[i] += s[i][j];\n if ( check ( s[i][j] ) )\n K--;\n }\n if ( K )\n {\n cout << \"NO\" << endl;\n return 0;\n }\n }\n ans[1] = ans[2] = ans[3] = ans[4] = 1;\n for ( ll i = 1; i <= n; i++ )\n {\n ll st = ( i - 1 ) * 4;\n f ( st + 1, st + 2, st + 3, st + 4 );\n }\n for ( ll i = 4; i >= 1; i-- )\n {\n if ( ans[i] )\n {\n print ( i );\n return 0;\n }\n }\n cout << \"NO\" << endl;\n return 0;\n}\n","testcases":"[{'input': '1 1\\r\\nday\\r\\nmay\\r\\nsun\\r\\nfun\\r\\n', 'output': ['aabb\\r\\n']}, {'input': '1 1\\r\\nday\\r\\nmay\\r\\ngray\\r\\nway\\r\\n', 'output': ['aaaa\\r\\n']}, {'input': '2 1\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\ne\\r\\ne\\r\\n', 'output': ['aabb\\r\\n']}, {'input': '2 1\\r\\nday\\r\\nmay\\r\\nsun\\r\\nfun\\r\\ntest\\r\\nhill\\r\\nfest\\r\\nthrill\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 5\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\ne\\r\\ne\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\nrezwbgy\\r\\nxakgmv\\r\\njogezwbgy\\r\\napezwbgy\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1\\r\\nnuqfxwrb\\r\\napqfkw\\r\\nuqfxwrb\\r\\nnhcuqfxwrb\\r\\nogkznwncmt\\r\\nevf\\r\\nogkznwncmt\\r\\nogkznwncmt\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\naawjvkxx\\r\\nawjvkxx\\r\\nxawjvkxx\\r\\nawjvkxx\\r\\n', 'output': ['aaaa\\r\\n']}, {'input': '2 2\\r\\nrhcujgxabk\\r\\nnjgdqpurul\\r\\nueoedt\\r\\ncpcfhbyvo\\r\\nzmfwnieog\\r\\npkpylassbf\\r\\nhrfeod\\r\\ncdwuil\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1\\r\\nol\\r\\nol\\r\\nol\\r\\nzol\\r\\nek\\r\\nek\\r\\nek\\r\\nqek\\r\\n', 'output': ['aaaa\\r\\n']}, {'input': '3 2\\r\\nexdaoao\\r\\nrdwunurp\\r\\ndunurp\\r\\ntyqzuxao\\r\\ndupocgsps\\r\\nzsiravcm\\r\\nnqiravcm\\r\\nlnupocgsps\\r\\niwashk\\r\\neepkqcykbv\\r\\nyviwashk\\r\\neepkqcykbv\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1\\r\\ndaihacbnhgfts\\r\\nsqihpntjvczkw\\r\\nmihpntjvczkw\\r\\nvyacbnhgfts\\r\\ntsvovdpqajmgvcj\\r\\ncexqkwrvctomb\\r\\njxbomb\\r\\ngnpajmgvcj\\r\\n', 'output': ['abba\\r\\n']}, {'input': '3 2\\r\\netba\\r\\ntfecetba\\r\\nzkitbgcuuy\\r\\nuuy\\r\\nbuxeoi\\r\\nmekxoi\\r\\nblviwoehy\\r\\niwoehy\\r\\njyfpaqntiz\\r\\nqvaqntiz\\r\\nhciak\\r\\niak\\r\\n', 'output': ['aabb\\r\\n']}, {'input': '4 3\\r\\niixxiojrrdytjcbkvymw\\r\\nbjqixxiojrrdytjcbkvymw\\r\\nogjixxiojrrdytjcbkvymw\\r\\nevixxpfxpgicpg\\r\\njkotitixiughfhphliuurx\\r\\ngyubkqtonejprfjzvqxbdpn\\r\\ndpudxfoqnhekjytbwiuurx\\r\\noubkqtonejprfjzvqxbdpn\\r\\npgzaendrxjhsfzjmijv\\r\\npomuaendrxjhsfzjmijv\\r\\nafyuyxueaendrxjhsfzjmijv\\r\\naendrxjhsfzjmijv\\r\\nyubweicj\\r\\ntbnsuxqigmxdfnmbipubweicj\\r\\nfuftydlmoo\\r\\nmdkuftydlmoo\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 2\\r\\nqurcmcbxyoddgyyccsmb\\r\\nlsdzsqoa\\r\\neurcmcbxyoddgyyccsmb\\r\\noa\\r\\nutyxmdhcvaclynmstwsx\\r\\nmkyycelbmkmdrilmbvr\\r\\nutyxmdhcvaclynmstwsx\\r\\nrduyelbmkmdrilmbvr\\r\\nhmguhvqswwciowwgu\\r\\nnoe\\r\\nzmyncuwrowwgu\\r\\nqrhymghavvbmigzsjoe\\r\\nbvofhknbzusykztlxwms\\r\\nbpbfmvjaimkdeddy\\r\\neofhknbzusykztlxwms\\r\\nmhivpkxkpazimkdeddy\\r\\negvywnhmfngllaknmn\\r\\nmblkvhenlggoftwjgk\\r\\nzegvywnhmfngllaknmn\\r\\ngrdenlggoftwjgk\\r\\n', 'output': ['abab\\r\\n']}, {'input': '7 3\\r\\nferwljzwakxedlgwl\\r\\noerwljzwakxedlgwl\\r\\nhyqombizhuhxedprb\\r\\netptjrizhuhxedprb\\r\\nurtuckar\\r\\ndkartmwramklcmi\\r\\nrurtuckar\\r\\nnurartmwramklcmi\\r\\niraziomsv\\r\\nsaziomsv\\r\\nbprapiqpayzurgij\\r\\nusyemayzurgij\\r\\nztstmeecvmkvuu\\r\\nquexlecvmkvuu\\r\\nrlhwecvmkvuu\\r\\nzecvmkvuu\\r\\niikymgbncljtub\\r\\nqiikymgbncljtub\\r\\nbcavhexqamyszgfya\\r\\nojexqamyszgfya\\r\\nieyxqinjinjv\\r\\nxtiudieyxqinjinjv\\r\\nthtceyxqinjinjv\\r\\nmuneyxqinjinjv\\r\\nwreae\\r\\nqylcjhjzfhteae\\r\\nozcjthgyuchqo\\r\\nfcjozcjthgyuchqo\\r\\n', 'output': ['NO\\r\\n']}, {'input': '16 1\\r\\ni\\r\\ni\\r\\ni\\r\\ni\\r\\ni\\r\\nu\\r\\ni\\r\\ni\\r\\no\\r\\na\\r\\na\\r\\no\\r\\na\\r\\ni\\r\\na\\r\\na\\r\\ni\\r\\ni\\r\\no\\r\\no\\r\\ni\\r\\ni\\r\\ni\\r\\ni\\r\\nu\\r\\nu\\r\\nu\\r\\nu\\r\\no\\r\\ne\\r\\ne\\r\\ne\\r\\no\\r\\ni\\r\\no\\r\\ni\\r\\na\\r\\na\\r\\na\\r\\na\\r\\nu\\r\\no\\r\\no\\r\\nu\\r\\ni\\r\\no\\r\\no\\r\\ni\\r\\na\\r\\na\\r\\ne\\r\\ne\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\no\\r\\na\\r\\na\\r\\nu\\r\\na\\r\\nu\\r\\nu\\r\\n', 'output': ['NO\\r\\n']}, {'input': '16 1\\r\\neb\\r\\neb\\r\\nfe\\r\\nce\\r\\ner\\r\\ner\\r\\new\\r\\new\\r\\nu\\r\\ncu\\r\\nu\\r\\nu\\r\\nud\\r\\nik\\r\\nud\\r\\nik\\r\\nve\\r\\niw\\r\\niw\\r\\nne\\r\\nel\\r\\nob\\r\\nel\\r\\nob\\r\\no\\r\\neo\\r\\no\\r\\nyo\\r\\nav\\r\\nav\\r\\nei\\r\\nmi\\r\\nu\\r\\noh\\r\\noh\\r\\nzu\\r\\niw\\r\\niw\\r\\na\\r\\nma\\r\\ni\\r\\nu\\r\\nku\\r\\ngi\\r\\nac\\r\\no\\r\\no\\r\\nac\\r\\ni\\r\\ner\\r\\nai\\r\\ner\\r\\nyu\\r\\nuf\\r\\nuf\\r\\nhu\\r\\nef\\r\\nef\\r\\nef\\r\\nef\\r\\nmu\\r\\nu\\r\\nqe\\r\\nie\\r\\n', 'output': ['NO\\r\\n']}, {'input': '25 1\\r\\nw\\r\\ni\\r\\nv\\r\\nx\\r\\nh\\r\\ns\\r\\nz\\r\\ny\\r\\no\\r\\nn\\r\\nh\\r\\ni\\r\\nf\\r\\nf\\r\\ny\\r\\nr\\r\\nb\\r\\nu\\r\\no\\r\\np\\r\\nz\\r\\nh\\r\\nt\\r\\no\\r\\nw\\r\\nx\\r\\nh\\r\\no\\r\\nj\\r\\ny\\r\\nw\\r\\nj\\r\\ny\\r\\nh\\r\\nh\\r\\nr\\r\\ns\\r\\nb\\r\\ny\\r\\nr\\r\\nw\\r\\no\\r\\nl\\r\\nl\\r\\nh\\r\\nh\\r\\nw\\r\\nu\\r\\na\\r\\nv\\r\\no\\r\\nx\\r\\nd\\r\\nw\\r\\nc\\r\\nf\\r\\ni\\r\\ne\\r\\nj\\r\\nq\\r\\nk\\r\\na\\r\\ne\\r\\nl\\r\\nw\\r\\nm\\r\\nf\\r\\na\\r\\nc\\r\\na\\r\\nb\\r\\nf\\r\\nj\\r\\nb\\r\\nx\\r\\ni\\r\\nx\\r\\ne\\r\\nu\\r\\nh\\r\\nm\\r\\no\\r\\ni\\r\\nq\\r\\nm\\r\\nk\\r\\nn\\r\\nd\\r\\nl\\r\\np\\r\\nc\\r\\nw\\r\\nu\\r\\nz\\r\\nc\\r\\nk\\r\\ng\\r\\ny\\r\\nj\\r\\ny\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\ne\\r\\ne\\r\\ne\\r\\ne\\r\\n', 'output': ['aaaa\\r\\n']}, {'input': '1 1\\r\\na\\r\\ne\\r\\ne\\r\\ne\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\ne\\r\\na\\r\\ne\\r\\ne\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\na\\r\\na\\r\\ne\\r\\ne\\r\\n', 'output': ['aabb\\r\\n']}, {'input': '1 1\\r\\ne\\r\\ne\\r\\na\\r\\ne\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\na\\r\\ne\\r\\na\\r\\ne\\r\\n', 'output': ['abab\\r\\n']}, {'input': '1 1\\r\\ne\\r\\na\\r\\na\\r\\ne\\r\\n', 'output': ['abba\\r\\n']}, {'input': '1 1\\r\\na\\r\\na\\r\\na\\r\\ne\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\ne\\r\\ne\\r\\ne\\r\\na\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\na\\r\\ne\\r\\ne\\r\\na\\r\\n', 'output': ['abba\\r\\n']}, {'input': '1 1\\r\\ne\\r\\na\\r\\ne\\r\\na\\r\\n', 'output': ['abab\\r\\n']}, {'input': '1 1\\r\\na\\r\\na\\r\\ne\\r\\na\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\ne\\r\\ne\\r\\na\\r\\na\\r\\n', 'output': ['aabb\\r\\n']}, {'input': '1 1\\r\\na\\r\\ne\\r\\na\\r\\na\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\ne\\r\\na\\r\\na\\r\\na\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\na\\r\\na\\r\\na\\r\\na\\r\\n', 'output': ['aaaa\\r\\n']}, {'input': '1 2\\r\\neraub\\r\\nbee\\r\\naab\\r\\nttbee\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10 1\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\ny\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 2\\r\\neeereaatktb\\r\\nbee\\r\\niaattb\\r\\nottbee\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\nab\\r\\nac\\r\\nad\\r\\naf\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\nar\\r\\nat\\r\\nay\\r\\naw\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1\\r\\na\\r\\ne\\r\\na\\r\\ne\\r\\na\\r\\na\\r\\na\\r\\na\\r\\n', 'output': ['abab\\r\\n']}, {'input': '1 1\\r\\na\\r\\ne\\r\\na\\r\\ni\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\na\\r\\ne\\r\\na\\r\\ne\\r\\n', 'output': ['abab\\r\\n']}, {'input': '1 1\\r\\nabbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbb\\r\\nabbbbbbbbbbbbbbbbfbbbbbbbbbbbbbbbb\\r\\nabbbbbbbbbbbbbbbbxbbbbbbbbbbbbbbbb\\r\\nabbbbbbbbbbbbbbbbdbbbbbbbbbbbbbbbb\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1\\r\\na\\r\\ne\\r\\ne\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\n', 'output': ['abba\\r\\n']}, {'input': '1 1\\r\\nbug\\r\\nsuy\\r\\nluh\\r\\ngut\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\nam\\r\\nat\\r\\nan\\r\\nag\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1\\r\\na\\r\\na\\r\\ne\\r\\ne\\r\\na\\r\\na\\r\\na\\r\\na\\r\\n', 'output': ['aabb\\r\\n']}, {'input': '1 4\\r\\naieoabcd\\r\\naeioabcd\\r\\naoeiabcd\\r\\naoieabcd\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 2\\r\\naec\\r\\naed\\r\\naek\\r\\naem\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1 1\\r\\nar\\r\\nab\\r\\nak\\r\\naz\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1\\r\\na\\r\\na\\r\\na\\r\\na\\r\\na\\r\\nb\\r\\nb\\r\\nb\\r\\n', 'output': ['NO\\r\\n']}]","id":39} {"description":"The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they should just go to bed early. They are desperate to come to an amicable agreement, so they decide to leave this up to chance.They take turns drawing a mouse from a bag which initially contains w white and b black mice. The person who is the first to draw a white mouse wins. After each mouse drawn by the dragon the rest of mice in the bag panic, and one of them jumps out of the bag itself (the princess draws her mice carefully and doesn't scare other mice). Princess draws first. What is the probability of the princess winning?If there are no more mice in the bag and nobody has drawn a white mouse, the dragon wins. Mice which jump out of the bag themselves are not considered to be drawn (do not define the winner). Once a mouse has left the bag, it never returns to it. Every mouse is drawn from the bag with the same probability as every other one, and every mouse jumps out of the bag with the same probability as every other one.","input_specification":"The only line of input data contains two integers w and b (0\u2009\u2264\u2009w,\u2009b\u2009\u2264\u20091000).","output_specification":"Output the probability of the princess winning. The answer is considered to be correct if its absolute or relative error does not exceed 10\u2009-\u20099.","notes":"NoteLet's go through the first sample. The probability of the princess drawing a white mouse on her first turn and winning right away is 1\/4. The probability of the dragon drawing a black mouse and not winning on his first turn is 3\/4 * 2\/3 = 1\/2. After this there are two mice left in the bag \u2014 one black and one white; one of them jumps out, and the other is drawn by the princess on her second turn. If the princess' mouse is white, she wins (probability is 1\/2 * 1\/2 = 1\/4), otherwise nobody gets the white mouse, so according to the rule the dragon wins.","sample_inputs":["1 3","5 5"],"sample_outputs":["0.500000000","0.658730159"],"src_uid":"7adb8bf6879925955bf187c3d05fde8c","lang_cluster":"C++","difficulty":1800,"human_solution":"#include\r\n#include\r\n#include\r\n#include\r\nusing namespace std;\r\nconst int MAXN=1010;\r\ndouble dp[MAXN][MAXN];\r\nint b,w;\r\nint main() \r\n{\r\n\tscanf(\"%d%d\",&w,&b);\r\n\tmemset(dp,0,sizeof(dp));\r\n\tfor(int i=1;i<=w;i++) \r\n\t{\r\n\t\tdp[i][0]=1;\r\n\t}\r\n\tfor(int i=1;i<=w;i++) \r\n\t{\r\n\t\tfor(int j=1;j<=b;j++) \r\n\t\t{\r\n\t\t\tdp[i][j]+=(double)i\/(i+j);\r\n\t\t\tif(j>=3) \r\n\t\t\t{\r\n\t\t\t\tdp[i][j]+=dp[i][j-3]*(double)j\/(i+j)*((double)(j-1)\/(i+j-1))*((double)(j-2)\/(i+j-2));\r\n\t\t\t}\r\n\t\t\tif(j>=2) \r\n\t\t\t{\r\n\t\t\t\tdp[i][j]+=dp[i-1][j-2]*(double)j\/(i+j)*((double)(j-1)\/(i+j-1))*((double)i\/(i+j-2));\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tprintf(\"%.9f\\n\",dp[w][b]);\r\n}\r\n\r\n\r\n\r\n","testcases":"[{'input': '1 3\\r\\n', 'output': ['0.50000000000000000', '0.500000000', '0.5', '0.5000000000']}, {'input': '5 5\\r\\n', 'output': ['0.65873015873015872', '0.65873015873', '0.6587301587301587', '0.658730159', '0.6587301587']}, {'input': '100 100\\r\\n', 'output': ['0.666295063', '0.66629506318483356', '0.666295063185', '0.6662950632', '0.6662950631848336']}, {'input': '100 1\\r\\n', 'output': ['0.990099010', '0.99009900990099009', '0.990099009901', '0.9900990099', '0.9900990099009901']}, {'input': '1 100\\r\\n', 'output': ['0.3366336634', '0.336633663', '0.336633663366', '0.33663366336633649', '0.3366336633663366', '0.3366336633663367']}, {'input': '67 420\\r\\n', 'output': ['0.5368972272908603', '0.5368972272908604', '0.5368972273', '0.536897227291', '0.53689722729086042', '0.536897227']}, {'input': '0 1000\\r\\n', 'output': ['0.0000000000', '0', '0.00000000000000000', '0.0', '0.000000000']}, {'input': '1000 0\\r\\n', 'output': ['1.00000000000000000', '1', '1.000000000', '1.0', '1.0000000000']}, {'input': '0 0\\r\\n', 'output': ['0.0000000000', '0', '0.00000000000000000', '0.0', '0.000000000']}, {'input': '1000 1000\\r\\n', 'output': ['0.666629617285', '0.66662961728533077', '0.6666296173', '0.666629617', '0.6666296172853308']}, {'input': '32 1000\\r\\n', 'output': ['0.5078702016771944', '0.507870202', '0.507870201677', '0.5078702017', '0.5078702016771942', '0.50787020167719410']}, {'input': '581 406\\r\\n', 'output': ['0.7084553684', '0.7084553684006947', '0.708455368401', '0.7084553684006948', '0.708455368', '0.70845536840069478']}, {'input': '459 52\\r\\n', 'output': ['0.907503321894', '0.907503322', '0.90750332189447191', '0.9075033218944719', '0.9075033219']}, {'input': '900 853\\r\\n', 'output': ['0.6726350392594106', '0.672635039259', '0.672635039', '0.6726350393', '0.67263503925941059']}, {'input': '778 218\\r\\n', 'output': ['0.8203333918681067', '0.8203333919', '0.820333391868', '0.82033339186810672', '0.820333392']}, {'input': '219 20\\r\\n', 'output': ['0.9225253192', '0.922525319170874', '0.922525319', '0.922525319171', '0.92252531917087399']}, {'input': '815 665\\r\\n', 'output': ['0.689921744986', '0.6899217450', '0.689921745', '0.6899217449860069', '0.68992174498600689']}, {'input': '773 467\\r\\n', 'output': ['0.726347986720404', '0.72634798672', '0.726347987', '0.7263479867', '0.72634798672040402']}, {'input': '215 269\\r\\n', 'output': ['0.6426266719', '0.642626671934', '0.642626672', '0.6426266719343681', '0.64262667193436807']}, {'input': '93 633\\r\\n', 'output': ['0.534192877', '0.5341928774', '0.534192877408', '0.53419287740827071', '0.5341928774082707']}, {'input': '267 270\\r\\n', 'output': ['0.665290172151', '0.665290172', '0.66529017215098862', '0.6652901721509885', '0.6652901722']}, {'input': '226 72\\r\\n', 'output': ['0.8050825614', '0.805082561415', '0.805082561', '0.80508256141467871', '0.8050825614146787']}, {'input': '666 436\\r\\n', 'output': ['0.71643507071908719', '0.716435071', '0.716435070719', '0.7164350707', '0.7164350707190872']}, {'input': '544 519\\r\\n', 'output': ['0.67186290453', '0.6718629045300779', '0.67186290453007791', '0.6718629045300778', '0.6718629045', '0.671862905']}, {'input': '141 883\\r\\n', 'output': ['0.536951106658', '0.53695110665839563', '0.5369511066583957', '0.536951107', '0.5369511067', '0.5369511066583955']}, {'input': '581 685\\r\\n', 'output': ['0.6488443851199316', '0.648844385', '0.64884438511993159', '0.6488443851', '0.6488443851199317', '0.64884438512']}, {'input': '459 487\\r\\n', 'output': ['0.660077509985', '0.660077509985014', '0.660077510', '0.66007750998501402', '0.6600775100']}, {'input': '980 133\\r\\n', 'output': ['0.89319092020478941', '0.8931909202', '0.8931909202047894', '0.893190920', '0.893190920205']}, {'input': '858 934\\r\\n', 'output': ['0.65733386720916775', '0.6573338672', '0.657333867209', '0.657333867', '0.6573338672091678']}, {'input': '455 299\\r\\n', 'output': ['0.7159327199974443', '0.7159327200', '0.715932720', '0.7159327199974445', '0.71593271999744446', '0.715932719997']}, {'input': '962 35\\r\\n', 'output': ['0.966054554', '0.96605455396450646', '0.9660545539645065', '0.966054553965', '0.9660545540']}, {'input': '840 837\\r\\n', 'output': ['0.6670201719', '0.6670201719431644', '0.667020172', '0.66702017194316443', '0.667020171943', '0.6670201719431645']}, {'input': '1000 483\\r\\n', 'output': ['0.75425988826697099', '0.7542598882669711', '0.754259888267', '0.754259888266971', '0.7542598883', '0.754259888']}, {'input': '958 285\\r\\n', 'output': ['0.81340504954416115', '0.813405050', '0.8134050495', '0.813405049544', '0.8134050495441612']}, {'input': '399 649\\r\\n', 'output': ['0.617507391', '0.617507391371', '0.61750739137083666', '0.6175073914', '0.6175073913708367']}, {'input': '277 451\\r\\n', 'output': ['0.61739616069488457', '0.617396161', '0.6173961607', '0.617396160695', '0.6173961606948846']}, {'input': '155 534\\r\\n', 'output': ['0.563323504', '0.5633235039', '0.56332350392237707', '0.5633235039223771', '0.563323503922', '0.563323503922377']}, {'input': '315 898\\r\\n', 'output': ['0.57457911437025666', '0.574579114', '0.5745791144', '0.57457911437', '0.5745791143702565']}, {'input': '193 700\\r\\n', 'output': ['0.5605440989561413', '0.5605440989561412', '0.560544099', '0.56054409895614132', '0.560544098956', '0.5605440990']}, {'input': '713 65\\r\\n', 'output': ['0.9228168302093307', '0.922816830209', '0.9228168302', '0.922816830', '0.92281683020933070']}, {'input': '377 720\\r\\n', 'output': ['0.60369716809047824', '0.603697168', '0.6036971681', '0.6036971680904782', '0.60369716809', '0.6036971680904784']}, {'input': '817 522\\r\\n', 'output': ['0.7194394264554227', '0.719439426', '0.7194394265', '0.71943942645542269', '0.719439426455']}, {'input': '695 168\\r\\n', 'output': ['0.8369446556', '0.836944655612', '0.836944656', '0.8369446556124126', '0.83694465561241260']}, {'input': '574 969\\r\\n', 'output': ['0.61421649332134520', '0.6142164933213452', '0.6142164933', '0.614216493321', '0.614216493']}, {'input': '95 334\\r\\n', 'output': ['0.5621827921', '0.562182792', '0.56218279214960909', '0.562182792149609', '0.56218279215']}, {'input': '691 417\\r\\n', 'output': ['0.726476058', '0.726476058107', '0.72647605810741833', '0.7264760581', '0.7264760581074183']}, {'input': '132 781\\r\\n', 'output': ['0.53893982877953017', '0.53893982878', '0.538939829', '0.5389398287795302', '0.5389398288']}, {'input': '10 583\\r\\n', 'output': ['0.5042409294514335', '0.504240929', '0.504240929451434', '0.504240929451', '0.5042409295', '0.50424092945143373']}, {'input': '888 385\\r\\n', 'output': ['0.767717438', '0.7677174382', '0.767717438191', '0.76771743819087279', '0.7677174381908728']}, {'input': '329 31\\r\\n', 'output': ['0.9205443823', '0.92054438231593871', '0.920544382', '0.9205443823159387', '0.920544382316']}, {'input': '73 405\\r\\n', 'output': ['0.541293398', '0.5412933980482019', '0.541293398048', '0.5412933980', '0.54129339804820187', '0.541293398048202']}, {'input': '513 488\\r\\n', 'output': ['0.6721873792029164', '0.672187379203', '0.67218737920291638', '0.672187379', '0.6721873792', '0.6721873792029165']}, {'input': '391 852\\r\\n', 'output': ['0.593281183103', '0.593281183', '0.59328118310294298', '0.593281183102943', '0.5932811831', '0.5932811831029428']}, {'input': '551 654\\r\\n', 'output': ['0.6481418383312834', '0.6481418383', '0.648141838', '0.64814183833128336', '0.648141838331']}, {'input': '429 19\\r\\n', 'output': ['0.95923426755053587', '0.959234268', '0.959234267551', '0.9592342675505359', '0.9592342676']}, {'input': '387 102\\r\\n', 'output': ['0.8272193027', '0.827219302673', '0.82721930267281030', '0.8272193026728103', '0.827219303']}, {'input': '827 466\\r\\n', 'output': ['0.73500588145506107', '0.735005881', '0.735005881455', '0.7350058814550611', '0.7350058815']}, {'input': '705 268\\r\\n', 'output': ['0.78394613169627603', '0.783946131696276', '0.7839461317', '0.783946132', '0.783946131696']}, {'input': '864 70\\r\\n', 'output': ['0.930218970', '0.9302189702459666', '0.9302189702', '0.93021897024596656', '0.930218970246']}, {'input': '743 715\\r\\n', 'output': ['0.670910005048', '0.670910005', '0.6709100050', '0.67091000504834808', '0.6709100050483481']}, {'input': '50 372\\r\\n', 'output': ['0.5314489794456663', '0.53144897944566638', '0.5314489794456665', '0.5314489794', '0.531448979446', '0.531448979']}]","id":40} {"description":"As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to n. After that, he asked each one: \"Which one committed the crime?\". Suspect number i answered either \"The crime was committed by suspect number ai\", or \"Suspect number ai didn't commit the crime\". Also, the suspect could say so about himself (ai\u2009=\u2009i).Sherlock Holmes understood for sure that exactly m answers were the truth and all other answers were a lie. Now help him understand this: which suspect lied and which one told the truth?","input_specification":"The first line contains two integers n and m (1\u2009\u2264\u2009n\u2009\u2264\u2009105,\u20090\u2009\u2264\u2009m\u2009\u2264\u2009n) \u2014 the total number of suspects and the number of suspects who told the truth. Next n lines contain the suspects' answers. The i-th line contains either \"+ai\" (without the quotes), if the suspect number i says that the crime was committed by suspect number ai, or \"-ai\" (without the quotes), if the suspect number i says that the suspect number ai didn't commit the crime (ai is an integer, 1\u2009\u2264\u2009ai\u2009\u2264\u2009n). It is guaranteed that at least one suspect exists, such that if he committed the crime, then exactly m people told the truth.","output_specification":"Print n lines. Line number i should contain \"Truth\" if suspect number i has told the truth for sure. Print \"Lie\" if the suspect number i lied for sure and print \"Not defined\" if he could lie and could tell the truth, too, depending on who committed the crime.","notes":"NoteThe first sample has the single person and he confesses to the crime, and Sherlock Holmes knows that one person is telling the truth. That means that this person is telling the truth.In the second sample there are three suspects and each one denies his guilt. Sherlock Holmes knows that only two of them are telling the truth. Any one of them can be the criminal, so we don't know for any of them, whether this person is telling the truth or not.In the third sample the second and the fourth suspect defend the first and the third one. But only one is telling the truth, thus, the first or the third one is the criminal. Both of them can be criminals, so the second and the fourth one can either be lying or telling the truth. The first and the third one are lying for sure as they are blaming the second and the fourth one.","sample_inputs":["1 1\n+1","3 2\n-1\n-2\n-3","4 1\n+2\n-3\n+4\n-1"],"sample_outputs":["Truth","Not defined\nNot defined\nNot defined","Lie\nNot defined\nLie\nNot defined"],"src_uid":"c761bb69cf1b5a3dbe38d9f5c46e9007","lang_cluster":"C++","difficulty":1600,"human_solution":"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\ntemplate T sqr(T a) { return a * a; }\n\nint a[101000];\nint murs[101000];\nint b[101000][2];\n\nint n, m;\n\nint main()\n{\n#ifdef IMPETUS\n freopen(\"input.txt\", \"r\", stdin);\n freopen(\"output.txt\", \"w\", stdout);\n#endif\n cin >> n >> m;\n for (int i = 0; i < n; i++)\n {\n cin >> a[i];\n if (a[i] > 0)\n b[a[i] - 1][0]++;\n else\n b[-a[i] - 1][1]++;\n }\n int sum = 0;\n for (int i = 0; i < n; i++)\n sum += b[i][1];\n int sols = 0;\n for (int i = 0; i < n; i++)\n if (sum - b[i][1] + b[i][0] == m)\n {\n sols++;\n murs[i] = 1;\n }\n string y = sols > 1 || sum == m ? \"Not defined\" : \"Truth\";\n string z = sols > 1 || sum == m ? \"Not defined\" : \"Lie\";\n for (int i = 0; i < n; i++)\n if (a[i] > 0)\n {\n if (murs[a[i] - 1])\n cout << y << endl;\n else\n cout << \"Lie\" << endl;\n }\n else\n {\n if (murs[-a[i] - 1])\n cout << z << endl;\n else\n cout << \"Truth\" << endl;\n }\n return 0;\n}","testcases":"[{'input': '1 1\\r\\n+1\\r\\n', 'output': ['Truth\\r\\n']}, {'input': '3 2\\r\\n-1\\r\\n-2\\r\\n-3\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '4 1\\r\\n+2\\r\\n-3\\r\\n+4\\r\\n-1\\r\\n', 'output': ['Lie\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\n']}, {'input': '1 0\\r\\n-1\\r\\n', 'output': ['Lie\\r\\n']}, {'input': '2 2\\r\\n+1\\r\\n+1\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\n']}, {'input': '2 1\\r\\n+2\\r\\n+1\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\n']}, {'input': '2 0\\r\\n-2\\r\\n-2\\r\\n', 'output': ['Lie\\r\\nLie\\r\\n']}, {'input': '3 1\\r\\n+2\\r\\n+3\\r\\n+3\\r\\n', 'output': ['Truth\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '6 3\\r\\n+5\\r\\n+5\\r\\n+5\\r\\n+1\\r\\n+1\\r\\n+1\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '4 3\\r\\n-4\\r\\n-3\\r\\n-1\\r\\n-3\\r\\n', 'output': ['Not defined\\r\\nTruth\\r\\nNot defined\\r\\nTruth\\r\\n']}, {'input': '10 4\\r\\n-8\\r\\n+1\\r\\n-6\\r\\n-10\\r\\n+5\\r\\n-6\\r\\n-8\\r\\n-8\\r\\n-4\\r\\n-8\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n-4\\r\\n+4\\r\\n+4\\r\\n-9\\r\\n-9\\r\\n-4\\r\\n-4\\r\\n+2\\r\\n-9\\r\\n-4\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '7 2\\r\\n+5\\r\\n+5\\r\\n+5\\r\\n-2\\r\\n+1\\r\\n-5\\r\\n-6\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\n']}, {'input': '7 4\\r\\n+7\\r\\n-3\\r\\n-3\\r\\n-4\\r\\n+3\\r\\n+3\\r\\n+3\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '6 3\\r\\n-6\\r\\n-1\\r\\n+5\\r\\n+1\\r\\n+6\\r\\n+1\\r\\n', 'output': ['Truth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\n']}, {'input': '5 3\\r\\n-2\\r\\n+2\\r\\n+2\\r\\n-3\\r\\n+5\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\n']}, {'input': '3 0\\r\\n-2\\r\\n-2\\r\\n-2\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '5 3\\r\\n-1\\r\\n-1\\r\\n-4\\r\\n+1\\r\\n-4\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '9 6\\r\\n+2\\r\\n+7\\r\\n+7\\r\\n-1\\r\\n-4\\r\\n+7\\r\\n-7\\r\\n+7\\r\\n+5\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '43 18\\r\\n-14\\r\\n-28\\r\\n+16\\r\\n+10\\r\\n+25\\r\\n-30\\r\\n+25\\r\\n+30\\r\\n+25\\r\\n+25\\r\\n+25\\r\\n+25\\r\\n-25\\r\\n+22\\r\\n+3\\r\\n-17\\r\\n+16\\r\\n-25\\r\\n+10\\r\\n+14\\r\\n+41\\r\\n+25\\r\\n-25\\r\\n+33\\r\\n+24\\r\\n-23\\r\\n-25\\r\\n+25\\r\\n-22\\r\\n+29\\r\\n+28\\r\\n-25\\r\\n-25\\r\\n-29\\r\\n+11\\r\\n+26\\r\\n-25\\r\\n+25\\r\\n+10\\r\\n+1\\r\\n-20\\r\\n-17\\r\\n+23\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '28 12\\r\\n+10\\r\\n-7\\r\\n+17\\r\\n-20\\r\\n+7\\r\\n-7\\r\\n+13\\r\\n-21\\r\\n-7\\r\\n-7\\r\\n-18\\r\\n+7\\r\\n+7\\r\\n+3\\r\\n+6\\r\\n+14\\r\\n+7\\r\\n-24\\r\\n-21\\r\\n-7\\r\\n-7\\r\\n+4\\r\\n+7\\r\\n-7\\r\\n+21\\r\\n-7\\r\\n-26\\r\\n+7\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '17 9\\r\\n-6\\r\\n+16\\r\\n+5\\r\\n+16\\r\\n-17\\r\\n+17\\r\\n-11\\r\\n+5\\r\\n+14\\r\\n+5\\r\\n-8\\r\\n-5\\r\\n+6\\r\\n-2\\r\\n-11\\r\\n+4\\r\\n+17\\r\\n', 'output': ['Truth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '14 3\\r\\n+14\\r\\n+12\\r\\n-9\\r\\n+9\\r\\n-9\\r\\n-9\\r\\n+8\\r\\n+9\\r\\n+2\\r\\n+1\\r\\n-13\\r\\n-9\\r\\n+13\\r\\n+3\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 4\\r\\n-9\\r\\n-8\\r\\n-5\\r\\n-9\\r\\n-7\\r\\n-9\\r\\n-9\\r\\n-9\\r\\n-4\\r\\n-9\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-5\\r\\n-1\\r\\n+10\\r\\n-3\\r\\n-10\\r\\n-9\\r\\n-10\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 4\\r\\n-3\\r\\n-3\\r\\n-3\\r\\n-3\\r\\n-3\\r\\n-2\\r\\n-2\\r\\n-6\\r\\n-7\\r\\n-3\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 6\\r\\n-9\\r\\n-7\\r\\n-5\\r\\n-5\\r\\n-4\\r\\n-2\\r\\n-8\\r\\n-5\\r\\n-5\\r\\n-9\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 4\\r\\n-8\\r\\n-2\\r\\n-8\\r\\n+1\\r\\n-4\\r\\n-8\\r\\n-2\\r\\n-8\\r\\n-8\\r\\n-1\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 2\\r\\n-8\\r\\n+10\\r\\n+1\\r\\n+8\\r\\n+4\\r\\n+8\\r\\n+6\\r\\n-8\\r\\n+10\\r\\n+1\\r\\n', 'output': ['Not defined\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 3\\r\\n+9\\r\\n+3\\r\\n+8\\r\\n+3\\r\\n+6\\r\\n-3\\r\\n+6\\r\\n+8\\r\\n+3\\r\\n+7\\r\\n', 'output': ['Lie\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\n']}, {'input': '10 8\\r\\n-2\\r\\n+9\\r\\n+9\\r\\n-4\\r\\n+9\\r\\n+9\\r\\n+4\\r\\n-9\\r\\n-3\\r\\n+9\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '10 7\\r\\n-4\\r\\n+6\\r\\n+4\\r\\n+9\\r\\n+6\\r\\n+6\\r\\n+6\\r\\n+6\\r\\n+6\\r\\n+2\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 4\\r\\n+3\\r\\n+5\\r\\n+6\\r\\n+10\\r\\n+5\\r\\n+5\\r\\n+6\\r\\n+8\\r\\n+5\\r\\n+6\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 7\\r\\n-6\\r\\n-10\\r\\n-3\\r\\n-1\\r\\n-3\\r\\n-7\\r\\n-2\\r\\n-7\\r\\n-7\\r\\n-3\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '10 5\\r\\n-4\\r\\n-4\\r\\n-1\\r\\n-5\\r\\n-7\\r\\n-4\\r\\n-4\\r\\n-4\\r\\n-1\\r\\n-7\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '10 5\\r\\n-9\\r\\n-7\\r\\n-6\\r\\n-3\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-2\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 3\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-3\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-8\\r\\n-4\\r\\n-10\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n-8\\r\\n-8\\r\\n-4\\r\\n-9\\r\\n-10\\r\\n-2\\r\\n-9\\r\\n-8\\r\\n-8\\r\\n-8\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n+7\\r\\n+8\\r\\n+9\\r\\n+1\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+6\\r\\n+6\\r\\n+7\\r\\n', 'output': ['Truth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 5\\r\\n+2\\r\\n+2\\r\\n+2\\r\\n+2\\r\\n+9\\r\\n+10\\r\\n+8\\r\\n+7\\r\\n+4\\r\\n+2\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 9\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+5\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '10 3\\r\\n+10\\r\\n+2\\r\\n+10\\r\\n+9\\r\\n+1\\r\\n+9\\r\\n+4\\r\\n+9\\r\\n+3\\r\\n+2\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 6\\r\\n+10\\r\\n+10\\r\\n+10\\r\\n+3\\r\\n+10\\r\\n+10\\r\\n+6\\r\\n+6\\r\\n+10\\r\\n+8\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '3 2\\r\\n-1\\r\\n+2\\r\\n+3\\r\\n', 'output': ['Truth\\r\\nNot defined\\r\\nNot defined\\r\\n']}]","id":41} {"description":"After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: \"Why on Earth does my program work so slowly?\" As he double-checked his code, he said: \"My code contains no errors, yet I know how we will improve Search Ultimate!\" and took a large book from the shelves. The book read \"Azembler. Principally New Approach\".Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. \"Search Ultimate will be faster than it has ever been!\" \u2014 the fellow shouted happily and set to work.Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands: [x] \u2014 returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax. lea x, y \u2014 assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the \"lea ebx, [eax]\" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value \u2014 the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx. On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as lea ecx, [eax + ebx],lea ecx, [k*eax]or evenlea ecx, [ebx + k*eax],where k = 1, 2, 4 or 8.As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:lea ebx, [eax + 4*eax] \/\/ now ebx = 5*eaxlea eax, [eax + 8*ebx] \/\/ now eax = eax + 8*ebx = 41*eaxIgor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.","input_specification":"The input data contain the only integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009255), which Igor K. is about to multiply.","output_specification":"On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255. Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers): lea x, [y] lea x, [y + z] lea x, [k*y] lea x, [y + k*z] Please note that extra spaces at the end of a command are unacceptable.","notes":null,"sample_inputs":["41","2","4"],"sample_outputs":["2\nlea ebx, [eax + 4*eax]\nlea ecx, [eax + 8*ebx]","1\nlea ebx, [eax + eax]","1\nlea ebx, [4*eax]"],"src_uid":"f71d1ffcea72f5b72ead3c0bcfa323f2","lang_cluster":"C++","difficulty":2500,"human_solution":"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n\n \nusing namespace std;\n \nconst int oo = 0x3f3f3f3f;\nconst double eps = 1e-9;\n\ntypedef long long ll;\ntypedef vector vi;\ntypedef vector vs;\ntypedef pair pii;\n \n#define sz(c) int((c).size())\n#define all(c) (c).begin(), (c).end()\n#define FOR(i,a,b) for (int i = (a); i < (b); i++)\n#define FORD(i,a,b) for (int i = int(b)-1; i >= (a); i--)\n#define FORIT(i,c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)\n\nint memo[12];\nint len[12];\nint op[12][3];\nint best, n;\nint bop[12][3];\nvoid rek(int dep){\n\tif(dep>=best)return;\n\tint le = dep+1;\n\tint maxi = memo[dep];\n\tif(maxi>n)return;\n\tif(maxi==n){\n\t\tbest = dep;\n\t\tFOR(i,0,dep)FOR(j,0,3)bop[i][j]=op[i][j];\n\t\treturn;\n\t}\n\tFORD(p1,0,le)FORD(p,0,le)FORD(i,0,4){\n\t\tint res = (1<> N;\n\tcalc(N);\n\tcout << best << endl;\n\tFOR(i,0,best){\n\t\tcout << \"lea e\" << (char)('b'+i) <<\"x, [\";\n\t\tif(bop[i][0]!=-1)cout << \"e\" <<(char)('a'+bop[i][0]) << \"x + \";\n\t\tif(bop[i][1]!=1)cout << bop[i][1] << \"*\";\n\t\tcout <<\"e\"<< (char)('a'+bop[i][2])<< \"x]\\n\";\n\t}\n\treturn 0;\n}\n","testcases":"[{'input': '41\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\n']}, {'input': '2\\r\\n', 'output': ['1\\r\\nlea ebx, [eax + eax]\\r\\n']}, {'input': '4\\r\\n', 'output': ['1\\r\\nlea ebx, [4*eax]\\r\\n']}, {'input': '6\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + eax]\\r\\n']}, {'input': '5\\r\\n', 'output': ['1\\r\\nlea ebx, [eax + 4*eax]\\r\\n']}, {'input': '14\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ecx + eax]\\r\\n']}, {'input': '15\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\n']}, {'input': '17\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\n']}, {'input': '7\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 2*eax]\\r\\n']}, {'input': '3\\r\\n', 'output': ['1\\r\\nlea ebx, [eax + 2*eax]\\r\\n']}, {'input': '16\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + eax]\\r\\nlea ecx, [8*ebx]\\r\\n']}, {'input': '58\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + ebx]\\r\\nlea eex, [edx + 4*eax]\\r\\n']}, {'input': '1\\r\\n', 'output': ['0\\r\\n']}, {'input': '8\\r\\n', 'output': ['1\\r\\nlea ebx, [8*eax]\\r\\n']}, {'input': '9\\r\\n', 'output': ['1\\r\\nlea ebx, [eax + 8*eax]\\r\\n']}, {'input': '10\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\n']}, {'input': '11\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*eax]\\r\\n']}, {'input': '12\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [4*ebx]\\r\\n']}, {'input': '13\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\n']}, {'input': '254\\r\\n', 'output': ['5\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + ebx]\\r\\nlea efx, [eex + 2*eax]\\r\\n']}, {'input': '197\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [eax + 4*edx]\\r\\n']}, {'input': '210\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [eax + 8*ecx]\\r\\nlea eex, [edx + edx]\\r\\n']}, {'input': '109\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\n']}, {'input': '233\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + 8*eax]\\r\\n']}, {'input': '220\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [eax + 2*ecx]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '167\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\nlea eex, [eax + 2*edx]\\r\\n']}, {'input': '63\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*ebx]\\r\\n']}, {'input': '171\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ebx + 2*ecx]\\r\\n']}, {'input': '126\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*ebx]\\r\\nlea eex, [edx + ebx]\\r\\n']}, {'input': '223\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [eax + 8*ecx]\\r\\nlea eex, [ecx + 2*edx]\\r\\n']}, {'input': '46\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + eax]\\r\\n']}, {'input': '207\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ebx]\\r\\nlea eex, [ebx + 2*edx]\\r\\n']}, {'input': '202\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '216\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '138\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '106\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [edx + edx]\\r\\n']}, {'input': '74\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + eax]\\r\\n']}, {'input': '129\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '191\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\nlea eex, [edx + 2*eax]\\r\\n']}, {'input': '67\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [8*eax]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '42\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + eax]\\r\\n']}, {'input': '104\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '235\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*ebx]\\r\\nlea eex, [eax + 2*edx]\\r\\n']}, {'input': '240\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [8*edx]\\r\\n']}, {'input': '116\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '57\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 2*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '200\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '28\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + eax]\\r\\n']}, {'input': '54\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + ebx]\\r\\n']}, {'input': '51\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '44\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*eax]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '147\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [eax + 2*ecx]\\r\\n']}, {'input': '82\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + eax]\\r\\n']}, {'input': '113\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '176\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [8*edx]\\r\\n']}, {'input': '66\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '118\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*ebx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '158\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [eax + 4*ebx]\\r\\nlea eex, [ecx + 4*edx]\\r\\n']}, {'input': '184\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + eax]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '172\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ebx + 2*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '94\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ebx]\\r\\nlea eex, [edx + 4*eax]\\r\\n']}, {'input': '221\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [ebx + 4*edx]\\r\\n']}, {'input': '100\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '139\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + 4*eax]\\r\\n']}, {'input': '187\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [ebx + 2*edx]\\r\\n']}, {'input': '192\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '130\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '244\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '115\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [ebx + 2*edx]\\r\\n']}, {'input': '59\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '183\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\nlea eex, [edx + 2*eax]\\r\\n']}, {'input': '120\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '251\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + 8*eax]\\r\\n']}, {'input': '189\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '47\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\n']}, {'input': '204\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '194\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [ecx + 8*edx]\\r\\n']}, {'input': '135\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '70\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '69\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [eax + 4*ecx]\\r\\n']}, {'input': '144\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '141\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '159\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '149\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\n']}, {'input': '173\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '90\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ebx]\\r\\n']}, {'input': '253\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*ebx]\\r\\nlea eex, [eax + 4*edx]\\r\\n']}, {'input': '125\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\n']}, {'input': '174\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 8*ebx]\\r\\nlea eex, [ecx + 2*edx]\\r\\n']}, {'input': '26\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\n']}, {'input': '157\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '179\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [eax + 2*edx]\\r\\n']}, {'input': '84\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '188\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '24\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [8*ebx]\\r\\n']}, {'input': '205\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '49\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\n']}, {'input': '136\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '225\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\n']}, {'input': '215\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ebx + 2*ecx]\\r\\nlea eex, [edx + 4*edx]\\r\\n']}, {'input': '153\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 8*ebx]\\r\\n']}, {'input': '143\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + 8*eax]\\r\\n']}, {'input': '248\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [8*edx]\\r\\n']}, {'input': '219\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '226\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '80\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '255\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '25\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\n']}, {'input': '228\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + ebx]\\r\\n']}, {'input': '148\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '134\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 2*ebx]\\r\\nlea eex, [ecx + 8*edx]\\r\\n']}, {'input': '98\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ebx]\\r\\nlea eex, [edx + 8*eax]\\r\\n']}, {'input': '114\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ebx + 8*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '91\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [eax + 2*ecx]\\r\\n']}, {'input': '218\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '55\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [eax + 2*ecx]\\r\\n']}, {'input': '214\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 4*ebx]\\r\\nlea eex, [ecx + 8*edx]\\r\\n']}, {'input': '237\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + 2*ebx]\\r\\n']}, {'input': '152\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 2*ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '155\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ebx + 2*ecx]\\r\\n']}, {'input': '166\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ecx]\\r\\nlea eex, [edx + 4*eax]\\r\\n']}, {'input': '201\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '193\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '36\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [4*ebx]\\r\\n']}, {'input': '185\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\n']}, {'input': '86\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '230\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + eax]\\r\\nlea eex, [edx + 4*edx]\\r\\n']}, {'input': '208\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [8*edx]\\r\\n']}, {'input': '145\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '209\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [eax + 8*edx]\\r\\n']}, {'input': '83\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\n']}, {'input': '40\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [8*ebx]\\r\\n']}, {'input': '76\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 2*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '31\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\n']}, {'input': '87\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ebx + 2*ecx]\\r\\n']}, {'input': '50\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 4*ecx]\\r\\n']}, {'input': '79\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [ebx + 2*edx]\\r\\n']}, {'input': '92\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ebx]\\r\\nlea eex, [edx + 2*eax]\\r\\n']}, {'input': '236\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ebx + 8*ecx]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '30\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '96\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '56\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 2*eax]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '45\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\n']}, {'input': '60\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '127\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*ebx]\\r\\nlea eex, [eax + 2*edx]\\r\\n']}, {'input': '48\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '65\\r\\n', 'output': ['2\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\n']}, {'input': '112\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + eax]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '61\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '75\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\n']}, {'input': '101\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\n']}, {'input': '232\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\nlea eex, [8*edx]\\r\\n']}, {'input': '224\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + eax]\\r\\nlea eex, [8*edx]\\r\\n']}, {'input': '213\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [eax + 4*edx]\\r\\n']}, {'input': '131\\r\\n', 'output': ['3\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [eax + 2*ecx]\\r\\n']}, {'input': '119\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*ebx]\\r\\nlea eex, [edx + 2*eax]\\r\\n']}, {'input': '107\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '62\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + ebx]\\r\\nlea eex, [edx + 8*eax]\\r\\n']}, {'input': '128\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '196\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '234\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ecx]\\r\\nlea eex, [edx + 8*ebx]\\r\\n']}, {'input': '18\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\n']}, {'input': '217\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '32\\r\\n', 'output': ['2\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [4*ebx]\\r\\n']}, {'input': '175\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\nlea eex, [ebx + 2*edx]\\r\\n']}, {'input': '198\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ecx]\\r\\nlea eex, [edx + 4*ebx]\\r\\n']}, {'input': '77\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '35\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\n']}, {'input': '29\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\n']}, {'input': '19\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 2*ebx]\\r\\n']}, {'input': '39\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '85\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\n']}, {'input': '111\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '247\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + 4*eax]\\r\\n']}, {'input': '161\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 2*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '68\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '117\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 4*ebx]\\r\\n']}, {'input': '239\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ebx + 8*ecx]\\r\\nlea eex, [ecx + 2*edx]\\r\\n']}, {'input': '156\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '199\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ebx]\\r\\nlea eex, [eax + 2*edx]\\r\\n']}, {'input': '78\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '227\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + 2*eax]\\r\\n']}, {'input': '160\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '180\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '142\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ebx + 2*ecx]\\r\\nlea eex, [ecx + 8*edx]\\r\\n']}, {'input': '181\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\n']}, {'input': '103\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '95\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 2*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\n']}, {'input': '99\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ebx]\\r\\n']}, {'input': '34\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ecx + ecx]\\r\\n']}, {'input': '250\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + 4*edx]\\r\\n']}, {'input': '89\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\n']}, {'input': '137\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '252\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + ebx]\\r\\n']}, {'input': '168\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '110\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '52\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '246\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + eax]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '178\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [edx + edx]\\r\\n']}, {'input': '211\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [eax + 8*ecx]\\r\\nlea eex, [eax + 2*edx]\\r\\n']}, {'input': '27\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\n']}, {'input': '105\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*eax]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '43\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ebx + 2*ecx]\\r\\n']}, {'input': '73\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\n']}, {'input': '124\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '121\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [eax + 8*ecx]\\r\\n']}, {'input': '133\\r\\n', 'output': ['3\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\n']}, {'input': '162\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ecx]\\r\\n']}, {'input': '20\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [4*ebx]\\r\\n']}, {'input': '102\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + ecx]\\r\\n']}, {'input': '154\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 8*ebx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '165\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\n']}, {'input': '72\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [8*ebx]\\r\\n']}, {'input': '33\\r\\n', 'output': ['2\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\n']}, {'input': '238\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ebx + 4*ecx]\\r\\nlea eex, [ecx + 8*edx]\\r\\n']}, {'input': '182\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [eax + 4*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '140\\r\\n', 'output': ['3\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '242\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ebx + 2*ecx]\\r\\nlea eex, [ecx + 8*edx]\\r\\n']}, {'input': '212\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [4*edx]\\r\\n']}, {'input': '245\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\nlea eex, [edx + 2*eax]\\r\\n']}, {'input': '164\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '195\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [8*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '241\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [ecx + 4*edx]\\r\\n']}, {'input': '108\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}, {'input': '81\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\n']}, {'input': '21\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\n']}, {'input': '186\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '243\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '22\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\n']}, {'input': '53\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\n']}, {'input': '151\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [ecx + 2*edx]\\r\\n']}, {'input': '122\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 8*eax]\\r\\nlea eex, [ecx + 4*edx]\\r\\n']}, {'input': '71\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 2*ebx]\\r\\nlea eex, [edx + 8*eax]\\r\\n']}, {'input': '222\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + eax]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '231\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*eax]\\r\\nlea edx, [ebx + 4*ecx]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '23\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*eax]\\r\\nlea edx, [eax + 2*ecx]\\r\\n']}, {'input': '37\\r\\n', 'output': ['2\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\n']}, {'input': '206\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ebx + 4*ecx]\\r\\nlea eex, [ecx + 4*edx]\\r\\n']}, {'input': '163\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [eax + 2*ecx]\\r\\n']}, {'input': '229\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + 4*eax]\\r\\n']}, {'input': '203\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 2*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '150\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + eax]\\r\\nlea edx, [ecx + 4*ecx]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '190\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 4*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\nlea eex, [edx + eax]\\r\\n']}, {'input': '64\\r\\n', 'output': ['2\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [8*ebx]\\r\\n']}, {'input': '93\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 2*ebx]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '123\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + 2*ecx]\\r\\n']}, {'input': '97\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*eax]\\r\\nlea edx, [ebx + 8*ecx]\\r\\n']}, {'input': '169\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 4*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ebx + 4*ecx]\\r\\n']}, {'input': '249\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + 2*eax]\\r\\nlea eex, [edx + 2*edx]\\r\\n']}, {'input': '38\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [ecx + eax]\\r\\n']}, {'input': '88\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 2*eax]\\r\\nlea edx, [8*ecx]\\r\\n']}, {'input': '146\\r\\n', 'output': ['3\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [eax + 8*ebx]\\r\\nlea edx, [ecx + ecx]\\r\\n']}, {'input': '170\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + 8*ebx]\\r\\nlea edx, [ecx + ecx]\\r\\nlea eex, [edx + 8*eax]\\r\\n']}, {'input': '177\\r\\n', 'output': ['4\\r\\nlea ebx, [eax + 8*eax]\\r\\nlea ecx, [ebx + ebx]\\r\\nlea edx, [ecx + 4*eax]\\r\\nlea eex, [eax + 8*edx]\\r\\n']}, {'input': '132\\r\\n', 'output': ['3\\r\\nlea ebx, [8*eax]\\r\\nlea ecx, [eax + 4*ebx]\\r\\nlea edx, [4*ecx]\\r\\n']}]","id":42} {"description":"Igor K. very much likes a multiplayer role playing game WineAge II. Who knows, perhaps, that might be the reason for his poor performance at the university. As any person who plays the game, he is interested in equipping his hero with as good weapon and outfit as possible. One day, as he was reading the game's forum yet again, he discovered a very interesting fact. As it turns out, each weapon in the game is characterised with k different numbers: a1,\u2009...,\u2009ak. They are called hit indicators and according to the game developers' plan they are pairwise coprime. The damage that is inflicted during a hit depends not only on the weapon's characteristics, but also on the hero's strength parameter. Thus, if the hero's strength equals n, than the inflicted damage will be calculated as the number of numbers on the segment , that aren't divisible by any hit indicator ai.Recently, having fulfilled another quest, Igor K. found a new Lostborn sword. He wants to know how much damage he will inflict upon his enemies if he uses it.","input_specification":"The first line contains two integers: n and k (1\u2009\u2264\u2009n\u2009\u2264\u20091013, 1\u2009\u2264\u2009k\u2009\u2264\u2009100). They are the indicator of Igor K's hero's strength and the number of hit indicators. The next line contains space-separated k integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u20091000). They are Lostborn sword's hit indicators. The given k numbers are pairwise coprime.","output_specification":"Print the single number \u2014 the damage that will be inflicted by Igor K.'s hero when he uses his new weapon. Please, do not use the %lld specificator to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specificator.","notes":null,"sample_inputs":["20 3\n2 3 5","50 2\n15 8"],"sample_outputs":["6","41"],"src_uid":"cec0f6c267fa76191a3784b08e39acd6","lang_cluster":"C++","difficulty":2600,"human_solution":"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#define LL long long\n#define mp(x, y) make_pair(x, y)\n#define pb(x) push_back(x)\n#define size(S) S.size()\n#define PII pair\n#define PID pair\n\nusing namespace std;\n\nconst int MAX = 300000;\nLL n, ans;\nint k, a[110];\nLL f[100][MAX];\n\nLL dfs(int x, LL n){\n\tif (x == k) return n;\n\tif (n < MAX && f[x][n] >= 0) return f[x][n];\n\tLL ret = dfs(x + 1, n) - dfs(x + 1, n \/ a[x]);\n\tif (n < MAX) f[x][n] = ret;\n\treturn ret;\n}\n\nint main(){\n\tcin >> n >> k;\n\tfor (int i = 0; i < k; i++) cin >> a[i];\n\tmemset(f, 255, sizeof(f));\n\tsort(a, a + k, greater());\n\tans = dfs(0, n);\n\tcout << ans << endl;\n}\n","testcases":"[{'input': '20 3\\r\\n2 3 5\\r\\n', 'output': ['6\\r\\n']}, {'input': '50 2\\r\\n15 8\\r\\n', 'output': ['41\\r\\n']}, {'input': '100 5\\r\\n10 9 7 11 19\\r\\n', 'output': ['56\\r\\n']}, {'input': '1 10\\r\\n2 3 5 7 11 13 17 19 23 29\\r\\n', 'output': ['1\\r\\n']}, {'input': '1000 10\\r\\n2 3 5 7 11 13 17 19 23 29\\r\\n', 'output': ['160\\r\\n']}, {'input': '666 5\\r\\n877 881 997 883 887\\r\\n', 'output': ['666\\r\\n']}, {'input': '4 2\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 1\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '211 4\\r\\n7 3 2 5\\r\\n', 'output': ['49\\r\\n']}, {'input': '2008 3\\r\\n7 9 11\\r\\n', 'output': ['1392\\r\\n']}, {'input': '1000 11\\r\\n29 23 19 17 13 1 11 7 5 3 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 6\\r\\n4 27 125 11 13 29\\r\\n', 'output': ['1\\r\\n']}, {'input': '50 5\\r\\n2 7 5 51 19\\r\\n', 'output': ['16\\r\\n']}, {'input': '997 11\\r\\n13 17 19 23 29 997 121 49 25 9 4\\r\\n', 'output': ['474\\r\\n']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '308 4\\r\\n5 2 7 3\\r\\n', 'output': ['70\\r\\n']}, {'input': '980 8\\r\\n17 2 3 11 5 13 19 7\\r\\n', 'output': ['166\\r\\n']}, {'input': '770 4\\r\\n3 5 2 7\\r\\n', 'output': ['176\\r\\n']}, {'input': '877 5\\r\\n7 2 11 3 5\\r\\n', 'output': ['182\\r\\n']}, {'input': '289 8\\r\\n19 13 5 7 11 3 23 17\\r\\n', 'output': ['99\\r\\n']}, {'input': '4943 38\\r\\n419 127 5 281 509 839 593 409 577 463 421 617 587 739 397 743 401 179 343 31 599 349 647 89 293 521 797 431 487 881 761 43 877 643 149 353 467 909\\r\\n', 'output': ['3375\\r\\n']}, {'input': '9619 35\\r\\n131 13 677 43 243 389 577 59 857 71 199 227 841 257 719 601 349 181 73 8 463 311 439 761 449 167 569 191 683 283 379 263 499 571 277\\r\\n', 'output': ['6578\\r\\n']}, {'input': '2852 62\\r\\n401 919 643 367 283 127 593 251 443 389 683 157 227 361 547 997 439 113 239 727 197 947 37 761 929 167 67 431 577 673 625 49 83 11 409 27 769 967 449 199 241 491 571 487 733 653 281 73 107 887 101 827 103 751 787 89 256 607 229 971 463 211\\r\\n', 'output': ['1826\\r\\n']}, {'input': '1138 12\\r\\n31 169 389 337 937 763 251 443 199 661 577 487\\r\\n', 'output': ['1074\\r\\n']}, {'input': '8849 56\\r\\n619 401 733 251 107 37 829 719 479 751 419 523 617 947 809 53 47 313 577 709 71 277 256 547 683 769 269 701 127 863 409 331 19 443 149 841 877 67 521 929 919 773 883 421 17 601 937 61 263 109 103 41 859 197 293 983\\r\\n', 'output': ['5875\\r\\n']}, {'input': '718 3\\r\\n770 337 743\\r\\n', 'output': ['716\\r\\n']}, {'input': '1785 69\\r\\n547 281 347 11 139 883 863 169 643 83 709 719 397 809 157 349 887 523 757 41 181 499 479 619 197 691 971 773 125 569 647 61 101 839 19 359 29 167 331 353 947 379 53 631 109 853 193 23 421 107 911 269 289 71 977 241 761 677 739 263 659 823 229 764 373 509 661 857 961\\r\\n', 'output': ['1020\\r\\n']}, {'input': '7990 37\\r\\n547 541 449 47 463 929 983 647 113 877 683 41 79 961 625 283 349 641 841 729 811 701 619 293 281 859 199 229 607 941 467 809 109 773 443 919 911\\r\\n', 'output': ['6922\\r\\n']}, {'input': '9566 91\\r\\n353 401 349 479 233 367 563 311 643 769 521 173 457 59 523 257 317 659 857 743 619 277 83 181 109 131 359 211 139 841 761 929 61 271 827 719 499 289 677 449 877 389 71 53 223 263 571 199 727 163 31 2 373 463 431 613 809 947 467 797 547 883 409 911 41 79 821 881 503 739 433 251 823 701 991 193 997 19 241 607 487 509 729 569 179 151 229 673 691 443 859\\r\\n', 'output': ['2982\\r\\n']}, {'input': '6254 91\\r\\n421 379 47 683 953 97 311 439 233 271 797 71 991 131 109 829 419 499 857 827 313 841 73 571 4 389 631 103 83 587 911 43 643 89 743 593 541 243 503 251 863 61 157 349 223 647 853 467 443 173 617 577 947 25 739 599 751 653 281 811 163 397 409 919 463 79 971 727 113 53 7 787 641 701 883 307 137 293 241 229 269 487 239 107 67 479 191 823 121 367 449\\r\\n', 'output': ['2399\\r\\n']}, {'input': '815442 99\\r\\n131 227 503 269 61 107 103 47 263 3 239 167 401 67 13 359 431 137 523 37 53 379 79 461 421 127 313 173 109 31 433 317 193 149 373 19 521 241 251 43 151 397 7 307 11 409 139 443 439 449 281 479 113 293 557 97 41 2 353 487 383 23 29 509 547 191 163 467 349 491 5 463 541 17 73 499 101 347 257 277 197 367 283 59 199 457 157 229 83 311 233 223 181 89 337 179 211 419 331\\r\\n', 'output': ['70035\\r\\n']}, {'input': '642382 96\\r\\n487 89 71 251 163 337 3 83 157 313 389 149 409 277 5 73 97 167 103 211 193 223 101 503 41 467 317 79 139 311 347 431 107 179 23 191 233 443 433 7 2 131 173 521 61 499 11 457 331 307 383 397 523 53 449 137 67 239 367 479 263 461 269 31 281 181 359 199 227 373 439 43 421 229 151 37 353 419 509 271 283 463 401 47 349 13 59 293 491 241 109 257 197 17 29 127\\r\\n', 'output': ['58572\\r\\n']}, {'input': '600972 66\\r\\n79 163 73 211 223 7 37 239 65 43 173 31 263 67 179 283 277 193 131 229 97 151 167 293 17 337 191 137 103 109 307 311 149 349 23 181 61 281 241 257 251 53 47 19 269 317 71 127 353 197 89 157 11 113 347 313 227 29 2 83 271 3 107 199 59 233\\r\\n', 'output': ['78012\\r\\n']}, {'input': '363161 80\\r\\n337 127 71 53 73 293 283 401 439 97 61 101 367 131 373 19 233 163 13 229 379 59 263 389 227 41 271 347 419 5 167 107 89 179 223 151 433 431 359 193 269 139 257 31 191 157 43 47 137 383 173 277 281 239 449 109 37 181 331 199 421 23 443 7 103 317 79 113 3 83 313 29 311 307 2 251 197 149 353 11\\r\\n', 'output': ['35160\\r\\n']}, {'input': '693133 76\\r\\n397 181 313 61 389 107 191 97 149 193 179 23 197 139 71 349 251 199 127 13 109 83 211 47 311 113 19 31 7 3 53 229 59 409 331 137 337 277 2 41 233 173 227 131 307 281 79 73 163 101 103 347 379 239 89 37 269 11 167 241 43 283 367 257 29 271 293 373 401 151 67 157 223 353 383 17\\r\\n', 'output': ['78449\\r\\n']}, {'input': '842450 58\\r\\n37 283 89 241 131 83 271 3 179 109 167 79 2 19 173 53 269 31 113 59 263 97 181 233 41 5 71 67 199 107 257 43 151 197 11 101 211 17 229 149 73 13 193 157 61 47 277 227 223 139 29 23 281 137 103 127 163 191\\r\\n', 'output': ['94467\\r\\n']}, {'input': '120713 99\\r\\n59 283 419 509 431 19 443 241 101 491 157 257 17 31 71 127 173 191 37 73 2 367 251 463 227 271 311 557 293 47 547 521 11 397 67 163 541 347 43 523 181 389 103 503 487 113 233 97 139 211 107 29 131 421 317 223 193 3 331 439 5 457 197 461 109 89 409 277 353 401 349 151 379 467 449 61 13 433 479 359 167 137 229 79 53 23 313 263 41 83 269 281 179 373 337 7 307 499 199\\r\\n', 'output': ['11305\\r\\n']}, {'input': '944214 61\\r\\n157 89 23 101 13 17 59 193 199 79 47 151 61 97 163 257 7 83 5 67 41 29 293 229 211 307 271 298 179 227 263 131 113 109 107 313 43 233 181 53 19 103 173 127 283 71 3 137 197 241 281 139 311 31 37 277 11 223 167 239 269\\r\\n', 'output': ['182663\\r\\n']}, {'input': '688274 81\\r\\n401 71 257 163 293 2 89 239 241 11 433 307 67 227 313 353 283 439 41 113 7 229 59 3 47 179 19 251 331 347 173 167 431 421 157 373 311 277 317 389 349 263 397 181 269 191 367 197 79 107 149 359 211 271 29 53 101 419 97 137 409 13 73 5 127 383 131 61 151 199 223 31 43 17 233 337 37 83 139 109 23\\r\\n', 'output': ['61497\\r\\n']}, {'input': '623511 55\\r\\n229 257 17 193 101 103 59 191 53 107 71 113 299 269 211 41 173 2 263 5 197 199 163 149 223 181 167 31 239 97 139 79 233 157 37 3 11 7 131 89 29 83 227 109 19 47 61 271 127 241 73 137 67 151 251\\r\\n', 'output': ['70330\\r\\n']}, {'input': '34202350 95\\r\\n991 181 541 361 659 271 563 577 163 751 961 81 719 43 383 491 101 535 67 389 191 619 709 587 353 529 179 73 121 13 127 607 431 853 569 797 347 79 251 17 409 401 41 193 839 199 211 811 487 601 881 733 241 883 599 239 197 229 49 521 461 787 677 311 503 421 757 613 841 349 821 59 857 727 379 47 151 877 419 643 83 337 103 4 467 443 167 977 439 773 109 479 373 683 97\\r\\n', 'output': ['14676536\\r\\n']}, {'input': '56124673 91\\r\\n181 67 307 409 71 29 89 31 97 659 709 19 241 503 727 823 859 691 971 37 599 227 313 587 967 883 149 937 773 49 379 557 787 11 827 331 367 839 929 757 863 619 257 509 223 947 593 173 487 761 401 25 563 199 661 547 953 983 821 479 461 293 569 311 103 577 433 601 353 271 169 59 733 463 919 419 151 289 449 643 877 43 829 9 467 349 769 631 431 337 457\\r\\n', 'output': ['27823308\\r\\n']}, {'input': '66663476 87\\r\\n81 37 347 227 41 359 25 859 163 809 727 541 829 841 463 919 23 593 599 361 211 839 797 151 343 373 773 907 677 821 13 199 853 571 739 577 367 877 491 379 277 289 257 157 941 883 121 173 769 761 499 233 421 419 961 107 229 709 523 337 461 293 569 857 197 443 433 241 397 479 137 997 179 887 281 127 619 953 823 643 977 317 743 191 467 64 67\\r\\n', 'output': ['41298098\\r\\n']}, {'input': '85912508 97\\r\\n193 971 647 373 757 433 263 283 223 361 101 229 829 379 181 419 239 941 431 523 211 947 107 967 457 47 827 103 131 577 811 911 617 641 709 691 61 53 683 797 751 467 761 163 787 289 2 401 661 257 463 233 739 191 607 853 863 769 281 307 563 487 109 491 631 79 149 241 919 961 977 13 179 983 479 37 331 719 613 353 625 337 701 541 349 121 311 673 277 173 347 83 89 991 73 7 383\\r\\n', 'output': ['23087838\\r\\n']}, {'input': '17439127 97\\r\\n653 563 383 971 529 607 431 113 401 625 101 587 683 29 281 421 223 857 37 263 367 53 107 61 457 283 571 103 331 557 521 911 449 17 593 863 443 307 71 929 31 227 761 947 257 701 277 163 887 751 79 733 757 409 229 797 361 773 659 419 541 487 149 359 577 769 353 233 239 631 3 131 739 613 7 193 139 137 179 953 256 997 271 199 197 983 293 673 463 499 617 241 907 647 461 479 977\\r\\n', 'output': ['6201590\\r\\n']}, {'input': '11541416 76\\r\\n653 563 419 337 243 73 809 787 509 487 271 587 521 647 289 461 197 257 863 263 31 103 107 397 677 659 997 431 839 953 701 379 919 239 661 127 443 191 743 389 821 227 281 71 571 293 89 881 523 857 331 109 977 971 911 167 343 241 199 83 883 547 499 853 641 43 137 617 601 829 125 823 151 613 947 121\\r\\n', 'output': ['8441427\\r\\n']}, {'input': '90742323 78\\r\\n491 443 419 121 283 347 577 601 307 149 733 73 683 137 739 23 691 179 53 863 467 239 827 947 139 569 173 829 383 353 919 887 701 853 47 127 659 697 653 251 571 953 269 13 839 719 359 233 101 463 331 457 71 971 421 773 67 431 593 479 809 317 243 4 257 563 107 907 37 125 751 157 151 911 619 841 499 677\\r\\n', 'output': ['43807233\\r\\n']}, {'input': '72884678 90\\r\\n491 157 419 593 673 307 211 601 313 613 953 617 853 709 811 311 41 757 347 859 283 607 229 941 503 269 463 983 107 379 449 83 523 67 739 59 719 653 797 81 433 883 101 431 113 461 587 971 293 557 251 907 769 71 89 139 263 277 197 547 227 317 959 127 809 43 439 947 37 353 359 73 599 961 701 167 373 911 509 223 17 397 64 929 683 521 421 29 13 19\\r\\n', 'output': ['39115199\\r\\n']}, {'input': '97550157 77\\r\\n577 157 761 367 79 331 547 101 757 243 503 139 839 863 811 457 47 647 977 419 61 739 229 773 971 947 449 467 619 491 16 641 991 401 409 677 431 179 797 887 37 433 113 701 599 523 853 487 397 443 83 997 137 673 907 227 41 683 197 199 73 71 89 169 17 617 809 421 239 751 271 53 719 827 769 787 509\\r\\n', 'output': ['61195229\\r\\n']}, {'input': '10169176 79\\r\\n613 121 967 251 743 653 43 499 419 167 49 139 383 827 277 541 529 961 59 739 61 89 397 227 179 169 601 467 127 883 919 401 947 263 193 16 593 661 757 523 269 211 313 557 647 163 389 577 83 443 337 607 719 911 271 311 881 157 181 19 131 81 491 773 433 811 67 137 281 751 353 431 821 439 359 487 853 457 727\\r\\n', 'output': ['6512164\\r\\n']}, {'input': '9976698153840 97\\r\\n491 257 227 467 101 17 163 521 337 313 181 211 61 349 503 367 107 3 233 103 239 433 401 73 113 47 139 43 331 389 499 197 479 463 431 359 487 353 223 251 283 83 421 109 281 317 11 79 157 443 269 461 277 293 23 97 397 199 419 229 457 41 547 173 509 59 149 5 31 7 89 179 449 151 37 19 137 71 167 131 439 379 2 311 29 263 523 53 409 13 271 241 347 193 373 191 307\\r\\n', 'output': ['908388043912\\r\\n']}, {'input': '9678048567267 95\\r\\n367 419 397 229 443 59 461 43 457 467 373 431 509 409 239 223 163 41 563 107 263 47 281 73 221 311 241 547 191 463 197 181 19 211 149 103 89 5 331 557 353 109 233 101 131 337 113 199 151 439 541 307 347 349 293 157 33 449 271 421 139 83 37 193 383 71 29 23 137 469 569 179 523 167 479 359 521 227 61 257 79 106 433 503 491 97 127 401 379 389 251 277 269 173 317\\r\\n', 'output': ['3897162195455\\r\\n']}, {'input': '9968915049080 100\\r\\n257 353 521 449 127 157 433 457 499 409 269 89 563 181 439 149 523 349 17 173 281 109 137 43 421 443 367 463 467 2 131 461 37 101 331 23 199 97 337 491 401 557 431 61 53 3 29 67 373 547 107 479 139 397 229 103 71 113 79 271 241 239 283 83 263 313 197 227 359 31 179 419 277 211 293 503 251 383 347 223 487 233 5 541 13 59 167 7 41 311 509 191 389 73 151 163 317 47 569 19\\r\\n', 'output': ['977074843979\\r\\n']}, {'input': '9768565482772 100\\r\\n317 229 421 251 203 101 509 383 311 107 199 293 541 409 487 397 257 5 149 193 223 163 439 67 347 83 569 103 109 137 479 179 593 503 271 191 227 41 349 331 547 419 353 337 313 13 281 577 557 139 461 571 367 173 431 181 233 269 43 389 521 113 263 449 523 97 61 3 151 211 443 31 241 373 457 467 37 19 59 2 563 73 587 131 379 79 307 239 283 127 47 71 23 433 187 277 197 53 499 157\\r\\n', 'output': ['1227370026994\\r\\n']}, {'input': '9671796206988 100\\r\\n137 107 419 421 197 113 389 97 557 487 271 229 19 563 131 523 181 53 239 401 227 467 7 409 71 59 433 491 157 479 2 3 173 29 383 47 313 283 347 73 373 163 277 179 331 499 109 263 251 443 367 317 269 61 461 151 83 13 211 31 127 463 449 67 167 199 503 457 257 439 353 139 311 307 5 349 11 379 23 281 101 293 17 191 521 571 241 569 193 79 41 43 233 397 223 509 103 541 359 337\\r\\n', 'output': ['894018567035\\r\\n']}, {'input': '9806951141493 99\\r\\n433 467 293 313 67 311 163 223 471 457 41 277 271 509 101 199 491 397 83 359 353 73 449 5 131 563 443 197 461 379 383 421 89 151 53 211 17 251 503 79 479 7 463 47 59 239 331 233 97 173 281 409 367 419 523 107 547 23 401 241 43 439 181 347 109 389 113 179 2 257 373 283 431 191 541 227 269 137 149 31 307 263 193 499 229 37 521 103 19 337 11 71 167 139 13 487 61 127 29\\r\\n', 'output': ['1314339720575\\r\\n']}, {'input': '9996326598719 98\\r\\n89 373 347 163 271 71 467 139 13 311 337 397 107 103 101 439 313 191 263 491 193 41 59 293 257 179 151 199 5 113 73 307 461 173 157 277 211 281 401 23 353 229 523 137 67 431 109 7 269 31 283 241 421 503 17 239 61 443 43 37 131 181 227 3 223 19 379 449 349 499 367 11 433 97 167 359 29 331 521 251 127 409 197 557 317 53 541 47 509 547 419 383 2 149 479 83 457 79\\r\\n', 'output': ['893840700159\\r\\n']}, {'input': '9930225951240 95\\r\\n211 347 251 131 181 239 191 457 127 463 353 397 61 503 197 163 569 331 37 101 547 401 277 67 23 349 203 467 11 379 317 227 337 73 107 113 83 439 53 157 17 223 2 383 47 269 409 487 359 431 271 479 179 193 13 167 19 41 311 109 491 563 31 433 449 139 283 509 281 419 199 233 367 79 43 173 313 241 421 71 103 521 499 97 523 293 137 257 5 89 443 263 373 149 389\\r\\n', 'output': ['1637980385783\\r\\n']}, {'input': '9597019411250 96\\r\\n397 487 541 383 229 443 59 13 109 179 79 263 41 283 7 23 17 463 281 2 433 199 223 137 347 127 467 83 227 89 3 29 233 181 101 251 307 197 37 337 457 31 317 61 157 313 389 103 107 43 167 47 353 421 509 149 419 269 349 151 131 67 277 491 503 331 71 113 257 311 499 19 271 239 359 11 479 449 367 379 439 293 523 241 97 191 139 401 53 73 461 373 409 521 965 431\\r\\n', 'output': ['1087130960247\\r\\n']}, {'input': '9886773646149 98\\r\\n181 499 223 419 19 557 71 509 283 11 163 17 439 397 127 67 521 349 281 479 331 197 389 563 179 461 173 3 2 167 101 317 373 37 31 367 199 61 433 43 193 151 229 23 541 523 109 311 383 463 421 59 271 73 239 379 409 251 107 457 113 79 241 401 29 89 35 103 157 137 353 233 139 307 211 83 97 293 431 569 359 149 491 487 337 191 41 263 277 467 47 313 443 449 547 269 53 257\\r\\n', 'output': ['1359913898511\\r\\n']}, {'input': '9795821923031 98\\r\\n2 7 11 13 15 17 19 23 29 31 37 41 43 47 53 59 67 71 73 79 83 89 97 101 103 107 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 373 379 383 389 397 401 409 419 421 431 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569\\r\\n', 'output': ['1564643642724\\r\\n']}, {'input': '9507905892355 99\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 409 419 421 431 433 439 443 449 457 461 463 467 487 491 499 503 509 521 523 541 547 557\\r\\n', 'output': ['849348619910\\r\\n']}, {'input': '9693931407793 98\\r\\n2 3 5 13 17 23 29 31 37 41 43 47 53 59 67 71 73 79 83 97 101 103 107 109 113 127 131 133 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 271 277 281 283 293 307 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 563 569 671\\r\\n', 'output': ['1189433268692\\r\\n']}, {'input': '9590161274760 99\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 503 509 521 541 547 557\\r\\n', 'output': ['854721606968\\r\\n']}, {'input': '9950847944431 100\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 127 131 137 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557\\r\\n', 'output': ['894249894895\\r\\n']}, {'input': '9500100903584 95\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 293 307 313 317 331 337 347 353 359 367 373 379 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541\\r\\n', 'output': ['858277370189\\r\\n']}, {'input': '9842961910207 95\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 461 463 467 479 487 491 499 503\\r\\n', 'output': ['882219504923\\r\\n']}, {'input': '9838785728264 96\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 89 97 103 107 109 113 127 131 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541\\r\\n', 'output': ['903236710045\\r\\n']}, {'input': '9867732421778 100\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 179 181 191 193 197 199 211 223 227 229 233 239 241 251 263 269 271 277 281 283 293 307 311 317 331 337 347 349 353 359 367 373 379 383 389 397 401 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571\\r\\n', 'output': ['896116476463\\r\\n']}, {'input': '9779523837247 96\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 499 503 509 521 523\\r\\n', 'output': ['883837021065\\r\\n']}, {'input': '9867630384078 96\\r\\n571 569 563 557 547 523 521 509 503 499 491 487 479 467 463 461 457 449 443 439 433 431 421 419 409 401 397 389 383 379 373 367 359 353 349 347 337 331 317 313 307 293 283 281 277 271 269 263 257 251 239 233 229 227 223 211 197 193 191 181 179 173 163 157 151 149 139 137 131 127 113 107 103 101 97 89 79 73 67 61 59 53 43 41 37 31 29 23 19 17 13 11 7 5 3 2\\r\\n', 'output': ['937747863784\\r\\n']}, {'input': '9875196562006 99\\r\\n587 577 571 569 563 557 547 541 523 521 509 503 491 487 467 463 461 457 443 439 433 431 421 419 409 401 397 391 389 383 379 373 367 359 353 347 337 331 317 313 311 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 157 151 149 139 137 131 127 113 107 103 101 97 89 83 73 71 67 61 59 53 47 43 41 37 31 29 19 13 11 7 5 3 2\\r\\n', 'output': ['995583778464\\r\\n']}, {'input': '9549571840708 96\\r\\n547 541 523 521 509 503 499 491 487 479 467 463 461 457 449 443 439 431 421 419 409 401 397 389 383 379 373 367 359 353 349 347 337 331 317 313 311 307 293 281 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 109 107 103 101 97 89 83 79 73 71 67 59 47 43 41 37 31 29 23 19 17 13 11 7 5 3 2\\r\\n', 'output': ['889647002352\\r\\n']}, {'input': '9911982578329 99\\r\\n571 569 563 557 547 541 523 521 509 503 499 491 487 479 467 463 461 457 449 443 439 433 431 421 419 409 401 397 389 379 373 367 353 349 347 337 331 317 313 311 293 283 281 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 113 109 107 103 101 97 89 83 73 71 67 61 53 47 43 41 37 31 29 23 19 17 13 11 7 5 3 2\\r\\n', 'output': ['913309108147\\r\\n']}, {'input': '9760780439447 95\\r\\n547 541 523 521 503 499 491 487 479 467 463 461 457 449 443 439 433 421 419 409 401 397 389 383 373 367 359 353 349 347 337 331 317 313 311 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 109 107 103 101 97 89 83 79 73 67 61 59 53 47 43 41 37 31 29 23 19 17 13 7 5 3 2\\r\\n', 'output': ['980142379577\\r\\n']}, {'input': '9776745118716 99\\r\\n571 569 563 557 547 541 523 521 509 503 491 479 467 463 461 457 449 443 439 433 431 421 419 409 401 397 389 383 379 377 373 367 359 353 349 347 337 331 317 313 311 307 293 283 277 271 269 263 257 251 241 239 233 229 227 223 211 199 193 191 181 173 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 23 19 17 11 7 5 3 2\\r\\n', 'output': ['980171747646\\r\\n']}, {'input': '9872727922459 100\\r\\n563 557 547 541 523 521 509 503 499 491 487 479 467 463 461 457 449 443 433 431 421 419 409 401 397 389 383 379 373 367 359 353 347 337 331 317 313 311 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 59 53 47 43 41 37 31 29 23 19 17 13 11 7 5 3 2\\r\\n', 'output': ['890601028930\\r\\n']}, {'input': '9819416028761 95\\r\\n521 509 503 499 491 487 479 467 463 461 457 449 443 439 433 431 421 419 409 401 397 389 383 379 373 367 359 353 349 347 337 331 317 313 311 307 293 283 281 277 271 269 263 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 23 19 17 13 11 5 3 2\\r\\n', 'output': ['1031126647049\\r\\n']}, {'input': '9763307060499 98\\r\\n569 563 557 547 541 523 521 509 503 499 491 487 479 467 463 461 457 449 439 433 421 419 409 401 397 389 383 379 373 367 359 353 349 347 337 331 317 313 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 109 107 103 101 97 89 83 73 71 67 61 59 53 47 43 41 37 31 29 23 19 17 11 7 5 3 2\\r\\n', 'output': ['959856047856\\r\\n']}, {'input': '9809248239466 100\\r\\n737 593 587 577 569 563 557 547 541 523 521 509 503 499 491 487 467 463 461 457 449 443 439 431 421 419 409 401 397 389 379 373 367 359 353 349 347 337 331 317 313 311 307 293 283 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 61 59 53 47 43 37 31 29 23 19 17 13 7 5 3 2\\r\\n', 'output': ['999773802890\\r\\n']}, {'input': '9903670365284 96\\r\\n109 229 373 677 499 31 727 841 199 811 907 625 2 563 251 131 67 313 619 137 293 359 17 461 97 331 173 107 491 307 419 709 857 379 181 769 839 139 223 733 193 71 157 479 43 541 211 233 127 269 421 243 569 353 257 167 37 103 529 337 283 983 701 19 343 383 593 121 991 977 113 503 317 823 349 457 587 431 463 683 601 367 523 947 617 311 919 647 59 829 467 859 953 509 599 641\\r\\n', 'output': ['2939448304654\\r\\n']}, {'input': '9502178257748 98\\r\\n821 883 373 113 499 659 907 331 617 163 809 709 857 383 223 937 379 512 811 103 863 79 83 643 257 599 173 107 467 769 81 277 613 271 991 947 523 293 121 47 23 757 419 727 89 853 61 761 317 241 463 961 181 997 509 607 37 359 49 269 977 503 283 19 983 541 67 281 97 839 397 43 823 461 797 701 719 353 25 409 601 421 677 73 347 193 859 647 587 881 971 829 13 547 179 641 877 229\\r\\n', 'output': ['5084295876526\\r\\n']}, {'input': '9642376788915 95\\r\\n397 883 373 991 499 727 827 523 401 887 173 461 857 193 239 757 929 313 631 683 71 251 103 677 347 449 611 641 439 557 27 109 233 977 797 479 139 569 829 349 23 821 613 431 89 853 343 761 607 311 67 907 107 773 317 37 691 359 289 881 113 503 41 64 269 463 197 281 769 839 181 137 941 739 83 229 643 293 5 409 353 787 191 73 593 241 619 859 257 809 971 937 997 163 179\\r\\n', 'output': ['4909262218143\\r\\n']}, {'input': '9700065114573 99\\r\\n311 691 191 991 599 727 479 547 229 41 23 439 919 71 11 53 17 271 631 617 521 839 359 281 131 353 613 401 197 157 743 109 223 101 937 929 139 293 347 79 173 3 337 241 461 683 277 761 467 827 811 907 7 107 449 37 947 211 607 457 677 8 239 809 269 997 541 29 409 419 163 647 941 769 787 491 883 757 775 509 641 661 373 89 643 179 569 619 443 127 397 821 971 151 361 859 739 523 701\\r\\n', 'output': ['2699236106797\\r\\n']}, {'input': '9846406935247 98\\r\\n571 367 53 43 769 29 307 991 557 113 449 59 397 271 751 967 761 151 857 401 277 773 997 281 887 523 349 3 197 673 853 823 577 101 521 389 619 883 659 881 947 37 337 149 211 691 569 641 797 97 163 223 61 47 457 347 683 157 13 977 121 229 41 79 269 631 499 293 727 353 643 839 421 599 241 757 181 4 125 877 257 467 653 73 313 811 953 677 89 941 199 419 233 563 251 859 739 929\\r\\n', 'output': ['2869839675507\\r\\n']}, {'input': '9578425604483 100\\r\\n727 257 827 701 859 169 353 887 19 997 449 97 137 761 631 139 467 811 709 401 967 7 233 109 719 113 11 9 683 37 853 373 733 941 971 131 461 883 71 577 863 617 349 509 661 937 67 263 271 541 43 773 647 47 419 523 857 499 367 347 503 313 311 797 269 907 103 223 307 983 691 337 167 607 89 5 127 409 163 101 977 241 389 512 463 643 743 431 277 929 641 739 839 79 251 359 557 443 227 193\\r\\n', 'output': ['3429244221786\\r\\n']}, {'input': '9850057469698 95\\r\\n191 193 37 113 443 139 227 109 911 797 449 173 409 613 59 463 809 811 857 401 491 163 41 769 821 211 487 647 971 503 643 709 461 419 991 353 311 157 11 383 739 313 577 541 961 661 751 599 761 947 421 631 653 7 379 433 397 239 64 499 3 169 367 509 571 977 941 479 53 983 359 593 953 883 179 127 97 251 73 863 859 67 101 457 659 5 107 467 691 701 43 61 607 587 877\\r\\n', 'output': ['2727577480774\\r\\n']}, {'input': '9986810815972 95\\r\\n191 641 137 127 163 733 929 887 257 157 757 43 739 337 421 229 49 521 941 401 967 277 107 881 821 173 16 789 379 743 269 121 461 857 83 953 223 683 233 101 409 839 701 617 751 53 811 103 761 529 883 631 361 17 367 937 523 67 313 449 179 169 463 593 73 661 499 479 311 673 131 659 599 541 787 331 97 349 281 397 961 29 439 625 647 271 997 709 691 773 457 71 89 139 919\\r\\n', 'output': ['5816290608872\\r\\n']}, {'input': '9607195420951 97\\r\\n571 223 997 131 163 631 283 953 47 79 19 977 7 809 59 41 617 127 941 863 383 529 43 431 73 277 64 263 463 547 433 169 443 857 757 379 71 683 349 89 761 743 31 541 227 53 557 67 167 233 449 487 601 797 991 647 661 677 311 613 83 317 191 709 883 27 251 281 887 947 521 839 139 587 173 331 503 179 359 491 673 197 823 157 523 373 307 919 389 641 691 569 653 829 911 853 271\\r\\n', 'output': ['4814783576041\\r\\n']}, {'input': '9671345835461 95\\r\\n647 289 487 887 911 503 283 311 449 821 281 19 7 239 661 71 439 839 941 691 683 733 577 431 421 277 4 827 233 863 619 631 401 293 149 307 701 109 739 241 761 773 769 211 227 79 547 563 47 809 27 107 601 797 83 953 37 929 101 967 521 199 463 271 883 163 169 907 461 811 41 823 677 139 331 263 557 613 467 383 673 569 157 317 523 743 89 373 125 397 529 61 593 113 349\\r\\n', 'output': ['3896254168046\\r\\n']}, {'input': '9980338415156 98\\r\\n197 541 383 151 71 463 283 79 823 683 811 593 523 887 353 761 439 701 479 691 103 13 829 431 337 277 397 181 461 47 619 991 433 191 907 101 317 983 367 61 59 883 499 211 827 107 769 653 547 857 81 311 643 571 223 401 229 67 19 967 257 41 239 587 449 2 797 977 227 971 487 557 43 139 241 263 617 149 37 859 131 809 839 709 467 379 613 293 863 727 157 937 577 757 199 389 11 841\\r\\n', 'output': ['2606358658461\\r\\n']}, {'input': '9925557094702 100\\r\\n53 587 311 83 631 571 821 823 593 709 811 157 347 257 11 37 439 169 509 163 877 613 289 461 883 997 97 743 383 47 619 79 271 947 467 659 317 653 729 661 929 463 167 211 647 107 983 263 887 8 443 113 599 547 223 173 361 569 229 953 577 751 349 421 853 967 373 139 227 313 487 269 563 827 233 193 617 809 199 431 131 277 529 71 911 881 241 503 863 641 857 937 281 353 727 719 389 337 101 89\\r\\n', 'output': ['5405714723943\\r\\n']}, {'input': '9568361248572 95\\r\\n443 239 683 53 631 121 853 863 541 839 953 347 499 89 109 409 83 907 17 211 439 97 103 937 71 601 811 127 79 313 467 197 569 503 787 107 317 43 887 181 163 101 389 479 857 359 983 521 751 3 419 463 551 643 769 941 677 73 229 199 397 23 449 823 421 967 617 625 179 379 487 919 37 31 173 947 739 2 271 61 131 727 647 263 461 809 281 149 929 641 431 593 523 241 571\\r\\n', 'output': ['1872180163221\\r\\n']}, {'input': '9893563607709 100\\r\\n349 557 229 211 61 619 941 569 673 19 467 653 983 359 109 127 121 907 139 293 23 613 257 607 251 97 709 151 509 883 43 197 41 8 313 367 331 199 131 827 79 991 503 181 727 449 73 841 787 541 419 887 49 677 67 523 191 743 157 3 397 137 173 823 421 773 643 431 179 89 881 857 797 853 563 401 929 479 647 383 683 757 271 641 977 113 971 691 547 311 601 163 373 953 769 659 877 239 101 499\\r\\n', 'output': ['3494740396912\\r\\n']}, {'input': '9879466421351 96\\r\\n223 281 547 149 409 243 431 257 263 499 293 647 887 523 563 127 113 361 109 769 929 311 773 677 443 593 739 251 103 691 367 83 569 797 313 557 47 331 25 211 463 173 641 37 229 751 757 487 859 227 439 359 937 433 67 137 661 743 317 4 613 199 977 269 467 271 853 727 179 397 881 983 169 911 503 839 683 419 947 883 151 653 733 719 509 461 577 919 961 607 107 41 599 541 421 89\\r\\n', 'output': ['4955531712402\\r\\n']}, {'input': '10000000000000 100\\r\\n31 61 257 199 29 17 227 269 281 151 73 113 229 167 13 211 397 67 107 131 139 127 173 59 491 241 89 2 461 109 3 293 313 317 283 149 431 239 521 401 503 179 97 41 37 449 11 439 193 271 307 337 251 433 103 467 379 389 43 83 373 101 419 523 541 487 479 79 367 509 499 347 137 349 5 277 409 359 463 233 353 383 47 23 197 71 19 157 263 223 181 7 421 457 311 191 53 163 443 331\\r\\n', 'output': ['887521393369\\r\\n']}, {'input': '10000000000000 100\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541\\r\\n', 'output': ['887521393369\\r\\n']}, {'input': '10000000000000 100\\r\\n541 523 521 509 503 499 491 487 479 467 463 461 457 449 443 439 433 431 421 419 409 401 397 389 383 379 373 367 359 353 349 347 337 331 317 313 311 307 293 283 281 277 271 269 263 257 251 241 239 233 229 227 223 211 199 197 193 191 181 179 173 167 163 157 151 149 139 137 131 127 113 109 107 103 101 97 89 83 79 73 71 67 61 59 53 47 43 41 37 31 29 23 19 17 13 11 7 5 3 2\\r\\n', 'output': ['887521393369\\r\\n']}, {'input': '10000000000000 100\\r\\n281 139 131 223 503 349 61 337 521 509 313 41 373 233 433 461 487 211 457 359 419 157 83 383 53 179 463 197 379 571 587 277 347 173 431 577 89 443 311 193 397 71 353 401 227 113 563 271 31 109 317 479 29 137 293 191 59 409 229 499 47 151 2 269 67 167 23 421 389 11 547 251 283 569 491 163 149 19 239 103 439 85 3 541 199 467 79 257 331 73 241 181 7 557 13 263 449 127 101 37\\r\\n', 'output': ['1210985628131\\r\\n']}, {'input': '10000000000000 100\\r\\n2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 491 499 503 509 521 523 541 547\\r\\n', 'output': ['896701239049\\r\\n']}]","id":43} {"description":"At a geometry lesson Gerald was given a task: to get vector B out of vector A. Besides, the teacher permitted him to perform the following operations with vector \u0410: Turn the vector by 90 degrees clockwise. Add to the vector a certain vector C.Operations could be performed in any order any number of times.Can Gerald cope with the task?","input_specification":"The first line contains integers x1 \u0438 y1 \u2014 the coordinates of the vector A (\u2009-\u2009108\u2009\u2264\u2009x1,\u2009y1\u2009\u2264\u2009108). The second and the third line contain in the similar manner vectors B and C (their coordinates are integers; their absolute value does not exceed 108).","output_specification":"Print \"YES\" (without the quotes) if it is possible to get vector B using the given operations. Otherwise print \"NO\" (without the quotes).","notes":null,"sample_inputs":["0 0\n1 1\n0 1","0 0\n1 1\n1 1","0 0\n1 1\n2 2"],"sample_outputs":["YES","YES","NO"],"src_uid":"cc8a8af1ba2b19bf081e379139542883","lang_cluster":"C++","difficulty":2000,"human_solution":"#include \r\r\n\r\r\nusing namespace std;\r\r\n\r\r\n#define pb push_back\r\r\n#define eb emplace_back\r\r\n#define f first\r\r\n#define s second\r\r\n#define deb(a) cerr << #a << \" = \" << a << \"\\n\";\r\r\n#define all(x) (x).begin(), (x).end()\r\r\n#define file() { ifstream cin(\"input.txt\"); ofstream cout(\"output.txt\"); }\r\r\n#define correct(x, y, n, m) (0 <= (x) && (x) < (n) && 0 <= (y) && (y) < (m))\r\r\n#define y1 y1212312\r\r\n#define int long long\r\r\n\r\r\ntypedef long long ll;\r\r\ntypedef long double ld;\r\r\ntypedef pair pii;\r\r\n\r\r\nconst ll INF = 2e18;\r\r\nconst ll mod = 1e9 + 7;\r\r\nconst int inf = 1e9;\r\r\nconst ld EPS = 1e-12;\r\r\nconst ld Pi = acosl(-1);\r\r\nconst int P = 31;\r\r\nconst int dx[2] = {0, 1};\r\r\nconst int dy[2] = {1, 0};\r\r\n\r\r\nint qqq = 1;\r\r\n\r\r\nmt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());\r\r\n\r\r\nint x1, y1, x2, y2, x3, y3;\r\r\n\r\r\nvoid solve() {\r\r\n cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;\r\r\n int leng = x3 * x3 + y3 * y3;\r\r\n for (int i = 0; i < 4; i++) {\r\r\n int x = x2 - x1;\r\r\n int y = y2 - y1;\r\r\n int dp = x * x3 + y * y3;\r\r\n int cp = x * y3 - y * x3;\r\r\n if (x == 0 && y == 0) {\r\r\n cout << \"YES\\n\";\r\r\n return;\r\r\n }\r\r\n if (leng && dp % leng == 0 && cp % leng == 0) {\r\r\n cout << \"YES\\n\";\r\r\n return;\r\r\n }\r\r\n x1 = -x1;\r\r\n swap(x1, y1);\r\r\n }\r\r\n cout << \"NO\\n\";\r\r\n}\r\r\n\r\r\nsigned main() {\r\r\n ios_base::sync_with_stdio(false);\r\r\n cin.tie(0); cout.tie(0);\r\r\n clock_t tStart = clock();\r\r\n \/\/cin >> qqq;\r\r\n while (qqq--) {\r\r\n solve();\r\r\n }\r\r\n cerr << \"Runtime is:\" << (long double) (clock() - tStart) \/ CLOCKS_PER_SEC << '\\n';\r\r\n return 0;\r\r\n}","testcases":"[{'input': '0 0\\r\\n1 1\\r\\n0 1\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n1 1\\r\\n1 1\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n1 1\\r\\n2 2\\r\\n', 'output': ['NO']}, {'input': '2 3\\r\\n2 3\\r\\n0 0\\r\\n', 'output': ['YES']}, {'input': '-4 -2\\r\\n0 0\\r\\n-2 -1\\r\\n', 'output': ['YES']}, {'input': '-100000000 -100000000\\r\\n100000000 100000000\\r\\n0 1\\r\\n', 'output': ['YES']}, {'input': '3 4\\r\\n-4 3\\r\\n1 7\\r\\n', 'output': ['YES']}, {'input': '1 1\\r\\n2 2\\r\\n-3 -3\\r\\n', 'output': ['YES']}, {'input': '0 1\\r\\n2 3\\r\\n7 -11\\r\\n', 'output': ['NO']}, {'input': '-2 2\\r\\n3 3\\r\\n5 0\\r\\n', 'output': ['YES']}, {'input': '1 3\\r\\n3 1\\r\\n3 3\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n0 0\\r\\n0 0\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n12 12\\r\\n0 0\\r\\n', 'output': ['NO']}, {'input': '0 100000000\\r\\n0 -100000000\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '100000000 4444\\r\\n-4444 -100000000\\r\\n50000000 50000000\\r\\n', 'output': ['YES']}, {'input': '45 6\\r\\n65 5\\r\\n0 5\\r\\n', 'output': ['NO']}, {'input': '1 0\\r\\n0 1\\r\\n2 1\\r\\n', 'output': ['YES']}, {'input': '7 11\\r\\n13 13\\r\\n0 4\\r\\n', 'output': ['YES']}, {'input': '4 2\\r\\n0 -1\\r\\n2 -2\\r\\n', 'output': ['NO']}, {'input': '4 -3\\r\\n-3 1\\r\\n0 -2\\r\\n', 'output': ['NO']}, {'input': '-2 -1\\r\\n0 1\\r\\n-2 -3\\r\\n', 'output': ['NO']}, {'input': '-1 1\\r\\n2 1\\r\\n-2 -1\\r\\n', 'output': ['NO']}, {'input': '4 0\\r\\n4 -3\\r\\n2 4\\r\\n', 'output': ['NO']}, {'input': '-3 -2\\r\\n-3 3\\r\\n4 4\\r\\n', 'output': ['NO']}, {'input': '2 1\\r\\n1 -4\\r\\n-4 -2\\r\\n', 'output': ['NO']}, {'input': '3 1\\r\\n1 -1\\r\\n-1 -4\\r\\n', 'output': ['NO']}, {'input': '2 -1\\r\\n-2 -4\\r\\n1 -1\\r\\n', 'output': ['NO']}, {'input': '0 4\\r\\n-1 -3\\r\\n4 1\\r\\n', 'output': ['NO']}, {'input': '-4 1\\r\\n-4 2\\r\\n0 -2\\r\\n', 'output': ['NO']}, {'input': '-2 -2\\r\\n-2 3\\r\\n3 -1\\r\\n', 'output': ['NO']}, {'input': '-3 0\\r\\n2 1\\r\\n-2 0\\r\\n', 'output': ['YES']}, {'input': '-1 -2\\r\\n3 -2\\r\\n-3 -1\\r\\n', 'output': ['NO']}, {'input': '3 1\\r\\n-2 3\\r\\n-2 -2\\r\\n', 'output': ['NO']}, {'input': '0 -4\\r\\n-1 -2\\r\\n0 1\\r\\n', 'output': ['YES']}, {'input': '-4 -4\\r\\n1 0\\r\\n-1 -3\\r\\n', 'output': ['NO']}, {'input': '2 0\\r\\n-2 1\\r\\n2 3\\r\\n', 'output': ['NO']}, {'input': '-2 4\\r\\n0 1\\r\\n-2 1\\r\\n', 'output': ['YES']}, {'input': '4 1\\r\\n2 -1\\r\\n3 0\\r\\n', 'output': ['YES']}, {'input': '2 3\\r\\n3 -3\\r\\n3 -2\\r\\n', 'output': ['NO']}, {'input': '2 4\\r\\n-4 1\\r\\n3 3\\r\\n', 'output': ['NO']}, {'input': '-4 -3\\r\\n-3 -4\\r\\n1 4\\r\\n', 'output': ['NO']}, {'input': '3 2\\r\\n1 0\\r\\n-4 -1\\r\\n', 'output': ['NO']}, {'input': '0 -4\\r\\n-3 -2\\r\\n3 -1\\r\\n', 'output': ['NO']}, {'input': '-2 2\\r\\n4 -2\\r\\n-2 -2\\r\\n', 'output': ['NO']}, {'input': '2 2\\r\\n-2 1\\r\\n0 -3\\r\\n', 'output': ['YES']}, {'input': '0 4\\r\\n1 1\\r\\n-4 2\\r\\n', 'output': ['NO']}, {'input': '-4 -4\\r\\n4 1\\r\\n-4 -2\\r\\n', 'output': ['NO']}, {'input': '-4 2\\r\\n4 -1\\r\\n-2 -1\\r\\n', 'output': ['YES']}, {'input': '-7 9\\r\\n-2 10\\r\\n-6 -4\\r\\n', 'output': ['NO']}, {'input': '4 7\\r\\n2 9\\r\\n-7 -6\\r\\n', 'output': ['NO']}, {'input': '-6 9\\r\\n6 6\\r\\n9 6\\r\\n', 'output': ['NO']}, {'input': '-9 4\\r\\n8 1\\r\\n-8 8\\r\\n', 'output': ['NO']}, {'input': '-4 3\\r\\n9 -2\\r\\n-3 -3\\r\\n', 'output': ['YES']}, {'input': '-1 -7\\r\\n3 -2\\r\\n-4 -3\\r\\n', 'output': ['NO']}, {'input': '-9 4\\r\\n-2 -8\\r\\n9 4\\r\\n', 'output': ['NO']}, {'input': '8 2\\r\\n-10 1\\r\\n10 -2\\r\\n', 'output': ['NO']}, {'input': '-7 9\\r\\n5 5\\r\\n-2 6\\r\\n', 'output': ['NO']}, {'input': '-8 1\\r\\n-10 -8\\r\\n1 -4\\r\\n', 'output': ['YES']}, {'input': '-65 -52\\r\\n31 -22\\r\\n0 -77\\r\\n', 'output': ['NO']}, {'input': '74 -55\\r\\n0 50\\r\\n-68 26\\r\\n', 'output': ['NO']}, {'input': '-84 28\\r\\n33 -15\\r\\n-19 93\\r\\n', 'output': ['NO']}, {'input': '69 -30\\r\\n-66 -100\\r\\n86 -38\\r\\n', 'output': ['NO']}, {'input': '-43 41\\r\\n-99 92\\r\\n-20 51\\r\\n', 'output': ['NO']}, {'input': '-17 -33\\r\\n56 -75\\r\\n-93 65\\r\\n', 'output': ['NO']}, {'input': '-95 -32\\r\\n-90 -43\\r\\n-40 16\\r\\n', 'output': ['NO']}, {'input': '-48 -92\\r\\n59 -39\\r\\n-45 14\\r\\n', 'output': ['NO']}, {'input': '95 -13\\r\\n22 -36\\r\\n-25 -60\\r\\n', 'output': ['NO']}, {'input': '81 -91\\r\\n88 91\\r\\n-90 -77\\r\\n', 'output': ['NO']}, {'input': '281 -914\\r\\n-217 113\\r\\n479 329\\r\\n', 'output': ['NO']}, {'input': '620 514\\r\\n-276 966\\r\\n578 106\\r\\n', 'output': ['NO']}, {'input': '-253 -283\\r\\n-400 834\\r\\n718 -701\\r\\n', 'output': ['NO']}, {'input': '478 884\\r\\n418 -713\\r\\n-704 -961\\r\\n', 'output': ['NO']}, {'input': '-380 -712\\r\\n-263 -104\\r\\n187 -329\\r\\n', 'output': ['NO']}, {'input': '-2919 -7389\\r\\n-4955 -1807\\r\\n2103 9400\\r\\n', 'output': ['NO']}, {'input': '6040 9662\\r\\n1903 7813\\r\\n5296 8638\\r\\n', 'output': ['NO']}, {'input': '-6008 -6748\\r\\n-7106 -5319\\r\\n-1940 8048\\r\\n', 'output': ['NO']}, {'input': '-2171 -9855\\r\\n4255 -3857\\r\\n6446 9559\\r\\n', 'output': ['NO']}, {'input': '-8916 9282\\r\\n2666 2344\\r\\n9109 -2730\\r\\n', 'output': ['NO']}, {'input': '-52856 -58459\\r\\n-41878 81991\\r\\n-22821 59850\\r\\n', 'output': ['NO']}, {'input': '10327 -86117\\r\\n-51156 -26888\\r\\n-41007 27453\\r\\n', 'output': ['NO']}, {'input': '-46921 46529\\r\\n87797 -73235\\r\\n18213 -86569\\r\\n', 'output': ['NO']}, {'input': '-66381 86177\\r\\n24332 -47590\\r\\n-57592 80499\\r\\n', 'output': ['NO']}, {'input': '-69415 74546\\r\\n37868 -89407\\r\\n19505 -59846\\r\\n', 'output': ['NO']}, {'input': '-817674 316187\\r\\n-934134 660884\\r\\n-297136 -482732\\r\\n', 'output': ['NO']}, {'input': '-127066 941778\\r\\n-654926 -838416\\r\\n809821 -229819\\r\\n', 'output': ['NO']}, {'input': '251893 526074\\r\\n593818 288991\\r\\n-120613 211128\\r\\n', 'output': ['NO']}, {'input': '910801 387995\\r\\n-846325 167413\\r\\n-425681 -149086\\r\\n', 'output': ['NO']}, {'input': '769260 131679\\r\\n-399548 -620680\\r\\n-439456 -164378\\r\\n', 'output': ['NO']}, {'input': '4931249 7448503\\r\\n8740191 1123509\\r\\n4410817 -3494433\\r\\n', 'output': ['NO']}, {'input': '6752575 4525855\\r\\n-2269760 5249721\\r\\n7718280 -5550799\\r\\n', 'output': ['NO']}, {'input': '9121753 -1624238\\r\\n1358642 -7305098\\r\\n9182854 -2204498\\r\\n', 'output': ['NO']}, {'input': '-8540887 -7511495\\r\\n-2659834 -6893955\\r\\n8115011 -3482324\\r\\n', 'output': ['NO']}, {'input': '-4664203 -2707147\\r\\n7039468 5543778\\r\\n5854600 -7808563\\r\\n', 'output': ['NO']}, {'input': '-33622572 -65473509\\r\\n-54144104 -59861983\\r\\n89814248 47623606\\r\\n', 'output': ['NO']}, {'input': '-75629161 -68114618\\r\\n23285096 90997125\\r\\n84795646 72358903\\r\\n', 'output': ['NO']}, {'input': '-79956125 -88524398\\r\\n10949698 32312326\\r\\n-76024701 -77225990\\r\\n', 'output': ['NO']}, {'input': '26164297 21666711\\r\\n-20848219 -49928045\\r\\n-36819763 26811563\\r\\n', 'output': ['NO']}, {'input': '98219518 -66590186\\r\\n14970849 -24409139\\r\\n82951915 43915349\\r\\n', 'output': ['NO']}, {'input': '67195377 58333196\\r\\n-60739152 -69557068\\r\\n-82003989 74825425\\r\\n', 'output': ['NO']}, {'input': '92141071 -48275413\\r\\n-47968469 -13277723\\r\\n-15839680 51548907\\r\\n', 'output': ['NO']}, {'input': '82237071 -62729681\\r\\n45778244 -73153917\\r\\n25235041 83636828\\r\\n', 'output': ['NO']}, {'input': '82539131 17433579\\r\\n-56091046 68716401\\r\\n-73706000 41779060\\r\\n', 'output': ['NO']}, {'input': '-21570525 17439241\\r\\n-47857043 39456884\\r\\n-36121539 69473879\\r\\n', 'output': ['NO']}, {'input': '-38 -99\\r\\n76 43\\r\\n53 -84\\r\\n', 'output': ['NO']}, {'input': '-52 0\\r\\n-60 -50\\r\\n-47 91\\r\\n', 'output': ['NO']}, {'input': '-53 30\\r\\n-14 -19\\r\\n-61 11\\r\\n', 'output': ['NO']}, {'input': '60 55\\r\\n-88 -38\\r\\n0 59\\r\\n', 'output': ['NO']}, {'input': '89 55\\r\\n-13 27\\r\\n-13 -81\\r\\n', 'output': ['NO']}, {'input': '76 73\\r\\n82 -92\\r\\n-95 95\\r\\n', 'output': ['NO']}, {'input': '-81 57\\r\\n-96 0\\r\\n-73 -58\\r\\n', 'output': ['NO']}, {'input': '0 45\\r\\n42 -47\\r\\n-51 -82\\r\\n', 'output': ['NO']}, {'input': '16 39\\r\\n95 18\\r\\n39 -64\\r\\n', 'output': ['NO']}, {'input': '-23 36\\r\\n-72 0\\r\\n44 -60\\r\\n', 'output': ['NO']}, {'input': '57 43\\r\\n58 -54\\r\\n-43 0\\r\\n', 'output': ['NO']}, {'input': '51 77\\r\\n-9 81\\r\\n0 79\\r\\n', 'output': ['NO']}, {'input': '0 14\\r\\n88 0\\r\\n88 0\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n48 0\\r\\n-62 68\\r\\n', 'output': ['NO']}, {'input': '-35 -90\\r\\n0 -42\\r\\n-8 -60\\r\\n', 'output': ['NO']}, {'input': '59 0\\r\\n84 -28\\r\\n0 58\\r\\n', 'output': ['NO']}, {'input': '10 -15\\r\\n23 0\\r\\n88 -36\\r\\n', 'output': ['NO']}, {'input': '-66 -34\\r\\n59 -38\\r\\n13 0\\r\\n', 'output': ['NO']}, {'input': '0 -14\\r\\n80 94\\r\\n-14 15\\r\\n', 'output': ['NO']}, {'input': '-28 0\\r\\n0 43\\r\\n0 -51\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n-30010581 33889813\\r\\n12862004 15575384\\r\\n', 'output': ['NO']}, {'input': '94993760 -37786635\\r\\n-75326491 -21534927\\r\\n77949983 95218547\\r\\n', 'output': ['NO']}, {'input': '72913933 0\\r\\n54300106 60510850\\r\\n32295823 -60694017\\r\\n', 'output': ['NO']}, {'input': '0 -77922994\\r\\n47873382 0\\r\\n-48532375 -33729248\\r\\n', 'output': ['NO']}, {'input': '-50600641 25410541\\r\\n0 80575245\\r\\n0 62979800\\r\\n', 'output': ['NO']}, {'input': '-34280877 -82070958\\r\\n66030914 -52671703\\r\\n0 -90987154\\r\\n', 'output': ['NO']}, {'input': '27523869 0\\r\\n52900492 0\\r\\n33031150 -65488267\\r\\n', 'output': ['NO']}, {'input': '69226391 60708120\\r\\n43106396 25795293\\r\\n80380957 88577789\\r\\n', 'output': ['NO']}, {'input': '0 40072438\\r\\n-61016486 88561432\\r\\n28431496 60485628\\r\\n', 'output': ['NO']}, {'input': '0 24078959\\r\\n75842668 -56466325\\r\\n-64025705 12045125\\r\\n', 'output': ['NO']}, {'input': '24334185 -27189752\\r\\n0 -47230185\\r\\n0 -37588021\\r\\n', 'output': ['NO']}, {'input': '45479363 56862079\\r\\n28029163 0\\r\\n-38736303 59867108\\r\\n', 'output': ['NO']}, {'input': '-66738889 -24309585\\r\\n-39387414 -42921545\\r\\n-10462276 0\\r\\n', 'output': ['NO']}, {'input': '-95534030 -14392539\\r\\n-89751090 79655267\\r\\n-77491839 40745315\\r\\n', 'output': ['NO']}, {'input': '-48666683 22046293\\r\\n77649947 84819904\\r\\n-32803712 -99366118\\r\\n', 'output': ['NO']}, {'input': '10150745 93724033\\r\\n-59625481 -18232739\\r\\n34384941 -28147896\\r\\n', 'output': ['NO']}, {'input': '-12344578 -26470996\\r\\n0 -25186906\\r\\n-11572514 -38120367\\r\\n', 'output': ['NO']}, {'input': '-59220368 0\\r\\n0 -75968891\\r\\n0 74081590\\r\\n', 'output': ['NO']}, {'input': '-78038627 -49761049\\r\\n0 22143739\\r\\n0 -60448485\\r\\n', 'output': ['NO']}, {'input': '80358706 0\\r\\n23898082 -87631921\\r\\n-48798084 88174414\\r\\n', 'output': ['NO']}, {'input': '10 13\\r\\n13 10\\r\\n0 0\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n10 13\\r\\n10 13\\r\\n', 'output': ['YES']}, {'input': '10 13\\r\\n0 0\\r\\n0 0\\r\\n', 'output': ['NO']}, {'input': '10 13\\r\\n-10 -13\\r\\n0 0\\r\\n', 'output': ['YES']}, {'input': '10 13\\r\\n-13 10\\r\\n0 0\\r\\n', 'output': ['YES']}, {'input': '100000000 1\\r\\n99999999 1\\r\\n0 0\\r\\n', 'output': ['NO']}, {'input': '100000000 1\\r\\n99999999 1\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '100000000 1\\r\\n99999999 1\\r\\n0 1\\r\\n', 'output': ['YES']}, {'input': '100000000 1\\r\\n99999999 1\\r\\n100000000 1\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n1 0\\r\\n100000000 0\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n1 1\\r\\n100000000 100000000\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n100000000 99999999\\r\\n100000000 100000000\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n99999999 1\\r\\n100000000 1\\r\\n', 'output': ['NO']}, {'input': '100000000 0\\r\\n99999999 1\\r\\n0 0\\r\\n', 'output': ['NO']}, {'input': '100000000 0\\r\\n99999999 1\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '100000000 0\\r\\n99999999 1\\r\\n100000000 1\\r\\n', 'output': ['YES']}, {'input': '100000000 0\\r\\n1 0\\r\\n100000000 0\\r\\n', 'output': ['NO']}, {'input': '100000000 0\\r\\n1 1\\r\\n100000000 100000000\\r\\n', 'output': ['NO']}, {'input': '100000000 0\\r\\n100000000 99999999\\r\\n100000000 100000000\\r\\n', 'output': ['NO']}, {'input': '100000000 0\\r\\n99999999 1\\r\\n100000000 1\\r\\n', 'output': ['YES']}, {'input': '100000000 100000000\\r\\n100000000 100000000\\r\\n0 1\\r\\n', 'output': ['YES']}, {'input': '5491 -1888\\r\\n58611137 -17279700\\r\\n5629 -7705\\r\\n', 'output': ['YES']}, {'input': '6791 1587\\r\\n23543337 24784850\\r\\n3970 2327\\r\\n', 'output': ['YES']}, {'input': '1214 8046\\r\\n84729946 38445218\\r\\n3488 -5838\\r\\n', 'output': ['YES']}, {'input': '-8725 -6466\\r\\n77278594 -3622341\\r\\n9344 -1256\\r\\n', 'output': ['YES']}, {'input': '-5922 -2466\\r\\n-46708374 -71085154\\r\\n-9882 298\\r\\n', 'output': ['YES']}, {'input': '4560 -6056\\r\\n97943322 -20616116\\r\\n-1107 -5440\\r\\n', 'output': ['YES']}, {'input': '-5645 2118\\r\\n-23770935 62615171\\r\\n-2080 9473\\r\\n', 'output': ['YES']}, {'input': '2630 8069\\r\\n-75372166 10085837\\r\\n-781 5563\\r\\n', 'output': ['YES']}, {'input': '-2588 9699\\r\\n50743921 -45114432\\r\\n-5288 -7358\\r\\n', 'output': ['YES']}, {'input': '6889 9158\\r\\n-843345 89332306\\r\\n7495 518\\r\\n', 'output': ['YES']}, {'input': '-2037 -1006\\r\\n-13301683 -83185771\\r\\n-3487 -4590\\r\\n', 'output': ['YES']}, {'input': '-925 -1240\\r\\n25904140 -92743662\\r\\n-8028 -2933\\r\\n', 'output': ['YES']}, {'input': '-573 5611\\r\\n-88934372 16274202\\r\\n-689 9294\\r\\n', 'output': ['YES']}, {'input': '-2859 7599\\r\\n37114911 -75750711\\r\\n-9150 -7398\\r\\n', 'output': ['YES']}, {'input': '-9234 9520\\r\\n58867682 17319702\\r\\n2273 -5831\\r\\n', 'output': ['YES']}, {'input': '3411 2674\\r\\n-21536783 -33506984\\r\\n-8254 -3778\\r\\n', 'output': ['YES']}, {'input': '1778735 -1803902\\r\\n-92875004 -2966747\\r\\n-4125460 1149178\\r\\n', 'output': ['YES']}, {'input': '-2413874 4166580\\r\\n83681508 25911924\\r\\n8615149 -6396049\\r\\n', 'output': ['YES']}, {'input': '5987456 -1627274\\r\\n-45083510 25782192\\r\\n-758074 971006\\r\\n', 'output': ['YES']}, {'input': '-881780 8157586\\r\\n-83355045 -86221641\\r\\n-5080144 1016625\\r\\n', 'output': ['YES']}, {'input': '836292 -1555463\\r\\n44451624 -63102407\\r\\n-7051275 -9619647\\r\\n', 'output': ['YES']}, {'input': '-5493123 4007625\\r\\n-49191721 -31674255\\r\\n-9754636 6418706\\r\\n', 'output': ['YES']}, {'input': '-2797960 2819364\\r\\n59202462 71529306\\r\\n7799041 -4640234\\r\\n', 'output': ['YES']}, {'input': '-7355750 -5710643\\r\\n-48075697 25746997\\r\\n-3569463 3650928\\r\\n', 'output': ['YES']}, {'input': '2517677 8638224\\r\\n-75757217 -17117074\\r\\n-2847910 1342478\\r\\n', 'output': ['YES']}, {'input': '-1782346 -522853\\r\\n56023653 37655619\\r\\n7455445 -936314\\r\\n', 'output': ['YES']}, {'input': '3922510 4979687\\r\\n-83613487 73792320\\r\\n-2355010 7196240\\r\\n', 'output': ['YES']}, {'input': '-2911250 -3788914\\r\\n9975544 20015444\\r\\n7278331 4185016\\r\\n', 'output': ['YES']}, {'input': '9495309 -4445256\\r\\n66581093 -48831427\\r\\n5864682 -8016505\\r\\n', 'output': ['YES']}, {'input': '-6389242 -2092524\\r\\n-18806778 85154882\\r\\n8457769 5141401\\r\\n', 'output': ['YES']}, {'input': '-6223066 -5334825\\r\\n36109780 -5416931\\r\\n3246899 -4890875\\r\\n', 'output': ['YES']}, {'input': '-1334950 3309875\\r\\n-20438919 -45390492\\r\\n-722222 280804\\r\\n', 'output': ['YES']}, {'input': '122542 -4826228\\r\\n-20855162 89301242\\r\\n8917870 2568139\\r\\n', 'output': ['YES']}, {'input': '-4662151 6642823\\r\\n-620983 29911124\\r\\n6914655 -1204368\\r\\n', 'output': ['YES']}, {'input': '806224 -7075643\\r\\n94593948 -33094579\\r\\n-540130 -5612242\\r\\n', 'output': ['YES']}, {'input': '2370720 9260730\\r\\n-31929898 43611588\\r\\n2817748 6788032\\r\\n', 'output': ['YES']}, {'input': '5 -12\\r\\n-47316040 -62956553\\r\\n-7 0\\r\\n', 'output': ['YES']}, {'input': '-7 0\\r\\n-51538008 -92285620\\r\\n-3 0\\r\\n', 'output': ['YES']}, {'input': '-12 9\\r\\n21015609 49124671\\r\\n3 2\\r\\n', 'output': ['YES']}, {'input': '-11 -10\\r\\n-1042937 89231497\\r\\n0 9\\r\\n', 'output': ['YES']}, {'input': '-3 11\\r\\n6154942 80496611\\r\\n5 0\\r\\n', 'output': ['YES']}, {'input': '-13 12\\r\\n826557 -90209918\\r\\n0 -5\\r\\n', 'output': ['YES']}, {'input': '-3 -9\\r\\n-72817057 -54284335\\r\\n-3 -1\\r\\n', 'output': ['YES']}, {'input': '-8 -8\\r\\n66949614 -53875176\\r\\n-2 -4\\r\\n', 'output': ['YES']}, {'input': '6 2\\r\\n-97096230 19770854\\r\\n-5 4\\r\\n', 'output': ['YES']}, {'input': '10 7\\r\\n91660376 -58581376\\r\\n0 -7\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n100000000 99999997\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n100000000 99999997\\r\\n0 1\\r\\n', 'output': ['YES']}, {'input': '-100000000 -100000000\\r\\n100000000 100000000\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n100000000 100000000\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '32 34\\r\\n-50070000 21003000\\r\\n0 1\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n100000000 99999999\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n1 1\\r\\n0 0\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n100000000 0\\r\\n1 2\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n100000000 99999999\\r\\n1 0\\r\\n', 'output': ['YES']}, {'input': '1 1\\r\\n1 2\\r\\n0 0\\r\\n', 'output': ['NO']}, {'input': '0 0\\r\\n4 2\\r\\n1 1\\r\\n', 'output': ['YES']}, {'input': '100000000 100000000\\r\\n0 0\\r\\n1 1\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n10000000 10000000\\r\\n1 1\\r\\n', 'output': ['YES']}, {'input': '1 2\\r\\n-2 1\\r\\n0 0\\r\\n', 'output': ['YES']}, {'input': '1 1\\r\\n1 -1\\r\\n0 0\\r\\n', 'output': ['YES']}, {'input': '0 0\\r\\n-63411382 -42720436\\r\\n123456 543253\\r\\n', 'output': ['YES']}]","id":44} {"description":"Gerald is positioned in an old castle which consists of n halls connected with n\u2009-\u20091 corridors. It is exactly one way to go from any hall to any other one. Thus, the graph is a tree. Initially, at the moment of time 0, Gerald is positioned in hall 1. Besides, some other hall of the castle contains the treasure Gerald is looking for. The treasure's position is not known; it can equiprobably be in any of other n\u2009-\u20091 halls. Gerald can only find out where the treasure is when he enters the hall with the treasure. That very moment Gerald sees the treasure and the moment is regarded is the moment of achieving his goal. The corridors have different lengths. At that, the corridors are considered long and the halls are considered small and well lit. Thus, it is possible not to take the time Gerald spends in the halls into consideration. The castle is very old, that's why a corridor collapses at the moment when somebody visits it two times, no matter in which direction. Gerald can move around the castle using the corridors; he will go until he finds the treasure. Naturally, Gerald wants to find it as quickly as possible. In other words, he wants to act in a manner that would make the average time of finding the treasure as small as possible. Each corridor can be used no more than two times. That's why Gerald chooses the strategy in such a way, so he can visit every hall for sure.More formally, if the treasure is located in the second hall, then Gerald will find it the moment he enters the second hall for the first time \u2014 let it be moment t2. If the treasure is in the third hall, then Gerald will find it the moment he enters the third hall for the first time. Let it be the moment of time t3. And so on. Thus, the average time of finding the treasure will be equal to .","input_specification":"The first line contains the only integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009105) \u2014 the number of halls in the castle. Next n\u2009-\u20091 lines each contain three integers. The i-th line contains numbers ai, bi and ti (1\u2009\u2264\u2009ai,\u2009bi\u2009\u2264\u2009n, ai\u2009\u2260\u2009bi, 1\u2009\u2264\u2009ti\u2009\u2264\u20091000) \u2014 the numbers of halls connected with the i-th corridor and the time needed to go along the corridor. Initially Gerald is in the hall number 1. It is guaranteed that one can get from any hall to any other one using corridors.","output_specification":"Print the only real number: the sought expectation of time needed to find the treasure. The answer should differ from the right one in no less than 10\u2009-\u20096.","notes":"NoteIn the first test the castle only has two halls which means that the treasure is located in the second hall. Gerald will only need one minute to go to the second hall from the first one.In the second test Gerald can only go from the first hall to the third one. He can get from the third room to the first one or to the second one, but he has already visited the first hall and can get nowhere from there. Thus, he needs to go to the second hall. He should go to hall 4 from there, because all other halls have already been visited. If the treasure is located in the third hall, Gerald will find it in a minute, if the treasure is located in the second hall, Gerald finds it in two minutes, if the treasure is in the fourth hall, Gerald will find it in three minutes. The average time makes 2 minutes.In the third test Gerald needs to visit 4 halls: the second, third, fourth and fifth ones. All of them are only reachable from the first hall. Thus, he needs to go to those 4 halls one by one and return. Gerald will enter the first of those halls in a minute, in the second one \u2014 in three minutes, in the third one - in 5 minutes, in the fourth one - in 7 minutes. The average time is 4 minutes. ","sample_inputs":["2\n1 2 1","4\n1 3 2\n4 2 1\n3 2 3","5\n1 2 1\n1 3 1\n1 4 1\n1 5 1"],"sample_outputs":["1.0","4.333333333333334","4.0"],"src_uid":"1590da32b7e64d0462550923cce34355","lang_cluster":"C++","difficulty":2300,"human_solution":"#include\n#define F first\n#define S second\n#define pii pair\n#define pb push_back\ntypedef long long ll;\ntypedef long double ld;\nusing namespace std;\nconst int N = 1e5 + 10;\nll dp[N] , sz[N] , t[N];\nvector a[N];\n\nbool cmp(pair , int> x , pair , int> y){\n ll p1 = x.F.F , p2 = y.F.F , s1 = x.F.S , s2 = y.F.S;\n return p1 * s2 < p2 * s1;\n}\n\nvoid dfs(int v,int p=-1){\n sz[v]++;\n vector , int> > childs;\n for(auto X:a[v]){\n int u = X.F , w = X.S;\n if(u == p)continue;\n dfs(u , v);\n sz[v]+=sz[u];\n t[v]+=t[u] + w;\n dp[v]+=w * sz[u] + dp[u];\n childs.pb({{t[u] + w , sz[u]} , u});\n }\n sort(childs.begin() , childs.end() ,cmp);\n ll tim = 0;\n for(auto X:childs){\n ll p = X.F.F , sz = X.F.S , ind = X.S;\n dp[v]+=(ll)2 * tim * sz;\n tim+=p;\n }\n return ;\n}\n\nint main(){\n ios_base::sync_with_stdio(0); cin.tie(0);\n int n; cin>>n;\n for(int i=0;i>u>>v>>w;\n a[u].pb({v , w});\n a[v].pb({u , w});\n }\n dfs(1);\n cout<\r\r\n#include\r\r\n#include\r\r\n#define check(i) i-p[0] && i-p[1] && i-p[2]\r\r\nint p[3],m[3],t[3],ans,dep;\r\r\nbool f[48][48][48][8][8];\r\r\nvoid dfs(int *p,int x,int y)\r\r\n{\r\r\n\tbool &res=f[p[0]][p[1]][p[2]][x][y]; if (res) return; res=1;\r\r\n\tint far=0,near=50;\r\r\n\tfor (int i=0;i<3;i++){\r\r\n\t\tif (p[i]<45 && p[i]>far) far=p[i];\r\r\n\t\tif (p[i]ans) ans=far;\r\r\n\tfor (int j=0;j<3;j++) {\r\r\n\t\tint q[3]={p[0],p[1],p[2]},z=1<=45){\r\r\n\t\t\tint T=p[j]-45;\r\r\n\t\t\tfor (int i=p[T]+t[T];p[T]<45 && i>=p[T]-t[T] && i>near-2 && i;i--)\r\r\n\t\t\t\tif (check(i)) q[j]=i,dfs(q,x,y);\r\r\n\t\t\t}\r\r\n\t\telse if (check(j+45)){\r\r\n\t\t\tif (y&z) for (int i=0;i<3;i++) if (fabs(p[i]-p[j])==1)\r\r\n\t\t\t\tq[i]=45+j,dfs(q,x,y^z),q[i]=p[i];\r\r\n\t\t\tif (x&z) for (int i=p[j]+m[j];i>=p[j]-m[j] && i>near-2 && i;i--)\r\r\n\t\t\t\tif (check(i)) q[j]=i,dfs(q,x^z,y);\r\r\n\t\t\t}\r\r\n\t\t}\r\r\n}\r\r\nint main()\r\r\n{\r\r\n\tfor (int i=0;i<3;i++) scanf(\"%d%d%d\",p+i,m+i,t+i);\r\r\n\tdfs(p,7,7); printf(\"%d\\n\",ans);\treturn 0;\r\r\n}","testcases":"[{'input': '9 3 3\\r\\n4 3 1\\r\\n2 3 3\\r\\n', 'output': ['15']}, {'input': '2 4 6\\r\\n3 5 5\\r\\n5 6 4\\r\\n', 'output': ['24']}, {'input': '3 8 1\\r\\n4 7 1\\r\\n5 6 1\\r\\n', 'output': ['15']}, {'input': '2 1 1\\r\\n6 1 1\\r\\n10 1 1\\r\\n', 'output': ['11']}, {'input': '1 5 3\\r\\n9 4 3\\r\\n6 3 3\\r\\n', 'output': ['17']}, {'input': '6 5 10\\r\\n9 7 10\\r\\n10 10 10\\r\\n', 'output': ['42']}, {'input': '1 1 1\\r\\n2 1 10\\r\\n5 1 1\\r\\n', 'output': ['15']}, {'input': '3 1 4\\r\\n2 1 3\\r\\n4 1 1\\r\\n', 'output': ['12']}, {'input': '7 1 5\\r\\n9 2 1\\r\\n6 3 3\\r\\n', 'output': ['19']}, {'input': '2 1 3\\r\\n1 1 4\\r\\n3 1 1\\r\\n', 'output': ['11']}, {'input': '1 1 10\\r\\n2 1 2\\r\\n3 5 1\\r\\n', 'output': ['20']}, {'input': '8 10 10\\r\\n9 10 10\\r\\n10 10 10\\r\\n', 'output': ['42']}, {'input': '7 9 10\\r\\n8 10 9\\r\\n10 9 10\\r\\n', 'output': ['40']}, {'input': '1 1 10\\r\\n9 3 3\\r\\n10 2 4\\r\\n', 'output': ['17']}, {'input': '1 1 1\\r\\n2 1 1\\r\\n3 1 1\\r\\n', 'output': ['7']}, {'input': '1 10 10\\r\\n5 10 10\\r\\n10 10 10\\r\\n', 'output': ['42']}, {'input': '1 1 9\\r\\n5 1 10\\r\\n10 1 8\\r\\n', 'output': ['11']}, {'input': '1 3 1\\r\\n5 1 4\\r\\n10 2 10\\r\\n', 'output': ['20']}, {'input': '1 2 2\\r\\n2 2 3\\r\\n10 1 10\\r\\n', 'output': ['11']}, {'input': '10 10 10\\r\\n1 1 1\\r\\n2 1 1\\r\\n', 'output': ['20']}, {'input': '1 2 5\\r\\n9 5 3\\r\\n5 5 4\\r\\n', 'output': ['20']}, {'input': '5 1 2\\r\\n10 5 1\\r\\n3 1 3\\r\\n', 'output': ['15']}, {'input': '1 2 1\\r\\n9 4 3\\r\\n3 4 3\\r\\n', 'output': ['13']}, {'input': '7 1 1\\r\\n10 3 4\\r\\n3 5 3\\r\\n', 'output': ['17']}, {'input': '1 5 5\\r\\n2 3 2\\r\\n4 3 4\\r\\n', 'output': ['16']}, {'input': '7 4 2\\r\\n1 2 5\\r\\n4 4 4\\r\\n', 'output': ['17']}, {'input': '4 5 2\\r\\n9 2 2\\r\\n5 2 4\\r\\n', 'output': ['17']}, {'input': '6 4 1\\r\\n4 1 3\\r\\n7 3 5\\r\\n', 'output': ['20']}, {'input': '8 3 5\\r\\n2 5 1\\r\\n9 1 5\\r\\n', 'output': ['19']}, {'input': '5 5 5\\r\\n3 5 3\\r\\n9 3 5\\r\\n', 'output': ['22']}, {'input': '4 5 3\\r\\n8 1 3\\r\\n9 3 1\\r\\n', 'output': ['18']}, {'input': '8 2 2\\r\\n3 5 5\\r\\n4 3 3\\r\\n', 'output': ['18']}, {'input': '10 9 10\\r\\n9 10 9\\r\\n8 10 10\\r\\n', 'output': ['41']}, {'input': '9 9 8\\r\\n10 10 9\\r\\n8 10 10\\r\\n', 'output': ['40']}, {'input': '8 10 10\\r\\n9 10 9\\r\\n10 10 10\\r\\n', 'output': ['41']}, {'input': '8 9 10\\r\\n10 8 10\\r\\n9 10 10\\r\\n', 'output': ['41']}, {'input': '8 10 1\\r\\n9 10 1\\r\\n10 10 1\\r\\n', 'output': ['24']}, {'input': '8 10 10\\r\\n9 10 10\\r\\n10 9 10\\r\\n', 'output': ['41']}, {'input': '7 10 10\\r\\n9 10 10\\r\\n10 10 10\\r\\n', 'output': ['42']}, {'input': '10 9 10\\r\\n8 10 10\\r\\n7 10 10\\r\\n', 'output': ['41']}, {'input': '8 1 6\\r\\n6 4 7\\r\\n5 8 6\\r\\n', 'output': ['28']}, {'input': '2 8 10\\r\\n5 9 7\\r\\n7 2 9\\r\\n', 'output': ['35']}, {'input': '6 6 7\\r\\n10 2 4\\r\\n5 5 7\\r\\n', 'output': ['28']}, {'input': '5 1 7\\r\\n6 8 6\\r\\n10 9 3\\r\\n', 'output': ['27']}, {'input': '9 7 9\\r\\n10 5 10\\r\\n2 7 9\\r\\n', 'output': ['37']}, {'input': '6 7 6\\r\\n9 2 4\\r\\n4 2 8\\r\\n', 'output': ['27']}, {'input': '4 4 3\\r\\n5 8 2\\r\\n8 6 7\\r\\n', 'output': ['25']}, {'input': '3 1 8\\r\\n2 5 4\\r\\n4 4 1\\r\\n', 'output': ['22']}, {'input': '2 4 2\\r\\n4 7 8\\r\\n8 8 5\\r\\n', 'output': ['25']}, {'input': '5 10 6\\r\\n7 7 7\\r\\n1 6 3\\r\\n', 'output': ['27']}, {'input': '4 6 5\\r\\n10 6 8\\r\\n1 3 3\\r\\n', 'output': ['23']}, {'input': '9 8 4\\r\\n8 2 3\\r\\n2 1 8\\r\\n', 'output': ['21']}, {'input': '3 3 9\\r\\n1 5 6\\r\\n7 2 6\\r\\n', 'output': ['24']}, {'input': '10 8 6\\r\\n3 9 4\\r\\n4 4 5\\r\\n', 'output': ['25']}, {'input': '3 4 3\\r\\n2 5 1\\r\\n4 5 1\\r\\n', 'output': ['15']}, {'input': '5 9 10\\r\\n6 10 2\\r\\n7 1 10\\r\\n', 'output': ['38']}, {'input': '4 2 4\\r\\n5 7 7\\r\\n8 8 9\\r\\n', 'output': ['27']}, {'input': '1 8 2\\r\\n3 9 8\\r\\n6 4 6\\r\\n', 'output': ['25']}, {'input': '8 7 6\\r\\n10 5 1\\r\\n3 1 5\\r\\n', 'output': ['22']}, {'input': '6 3 1\\r\\n2 3 4\\r\\n5 7 1\\r\\n', 'output': ['19']}, {'input': '10 10 6\\r\\n7 10 8\\r\\n6 5 5\\r\\n', 'output': ['35']}, {'input': '3 3 10\\r\\n7 6 7\\r\\n10 5 10\\r\\n', 'output': ['35']}, {'input': '1 8 6\\r\\n9 8 8\\r\\n5 6 5\\r\\n', 'output': ['30']}, {'input': '6 6 3\\r\\n9 10 1\\r\\n2 7 6\\r\\n', 'output': ['30']}, {'input': '5 2 4\\r\\n10 10 7\\r\\n9 5 9\\r\\n', 'output': ['30']}, {'input': '2 2 9\\r\\n9 5 1\\r\\n7 4 7\\r\\n', 'output': ['24']}, {'input': '1 10 6\\r\\n6 1 2\\r\\n9 9 6\\r\\n', 'output': ['25']}, {'input': '3 8 4\\r\\n1 7 3\\r\\n8 5 10\\r\\n', 'output': ['26']}, {'input': '1 7 1\\r\\n10 9 7\\r\\n5 10 5\\r\\n', 'output': ['25']}, {'input': '8 10 1\\r\\n2 5 6\\r\\n3 5 7\\r\\n', 'output': ['31']}, {'input': '5 5 1\\r\\n3 4 10\\r\\n6 5 10\\r\\n', 'output': ['32']}, {'input': '10 3 8\\r\\n2 3 6\\r\\n1 1 8\\r\\n', 'output': ['23']}, {'input': '2 10 3\\r\\n4 10 1\\r\\n8 8 6\\r\\n', 'output': ['25']}, {'input': '10 2 6\\r\\n1 5 7\\r\\n2 8 6\\r\\n', 'output': ['25']}, {'input': '2 5 1\\r\\n7 9 3\\r\\n6 2 10\\r\\n', 'output': ['29']}, {'input': '1 1 4\\r\\n8 10 5\\r\\n5 3 9\\r\\n', 'output': ['28']}, {'input': '1 7 1\\r\\n9 9 3\\r\\n5 4 1\\r\\n', 'output': ['20']}, {'input': '8 6 10\\r\\n3 7 8\\r\\n9 2 9\\r\\n', 'output': ['33']}, {'input': '9 6 8\\r\\n5 5 2\\r\\n2 5 2\\r\\n', 'output': ['22']}, {'input': '2 1 3\\r\\n1 3 7\\r\\n4 5 10\\r\\n', 'output': ['22']}, {'input': '1 10 10\\r\\n2 10 10\\r\\n10 10 10\\r\\n', 'output': ['42']}, {'input': '3 10 10\\r\\n7 10 10\\r\\n10 10 10\\r\\n', 'output': ['42']}]","id":46} {"description":"Vasya is about to take his first university exam in about several minutes. And it's not just some ordinary exam, it's on mathematical analysis. Of course, right now Vasya can only think of one thing: what the result of his talk with the examiner will be...To prepare for the exam, one has to study proofs of n theorems. It is known that there will be k examination cards on the exam and each card contains distinct theorems. Besides, no theorem is mentioned in more than one card (that is, theorems won't be mentioned in any card). During the exam several students may get the same card.We do not know the exact way theorems are distributed by cards, however the students that took the exam before Vasya told him what theorems their cards contained. Vasya evaluates his level of proficiency in the i-th theorem by some number ai. The level of proficiency in some card is the average of the levels of proficiency in the theorems that are included in the card. Now Vasya wants to know the minimally and maximally possible levels of his proficiency in the card he gets on the exam. Vasya wants to determine it by the data he has collected from other students. Unfortunately, Vasya has no time left to do the math and he asked you to help him.","input_specification":"The first line contains two integers n and k (1\u2009\u2264\u2009k\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of theorems and the number of cards correspondingly. The second line contains n integers ai (0\u2009\u2264\u2009ai\u2009\u2264\u2009100), the i-th number (1\u2009\u2264\u2009i\u2009\u2264\u2009n) corresponds to Vasya's proficiency in the i-th theorem. The third line contains number q (0\u2009\u2264\u2009q\u2009\u2264\u2009100) \u2014 the number of people that have taken the exam before Vasya. Each of the following q lines contains the description of a student's card: integers from 1 to n inclusive. They are the numbers of theorems included in the card in the order in which they are enumerated in the input data. The numbers are given in an arbitrary order. It is guaranteed that the given cards are valid (that is, that all theorems in one card are different and that different people get cards that either don't contain the same theorems or coincide up to the theorems' permutation).","output_specification":"Print two real numbers, representing Vasya's minimum and maximum proficiency in the card he will get on the exam. The absolute or relative error should not exceed 10\u2009-\u20096.","notes":"NoteLet's analyze the first sample. Vasya's proficiency in the cards whose content he already knows equals 6 and 15.5 correspondingly. The three theorems that are left are only enough to make one exam card. If we consider all possible variants of theorems included in the card we can see that in the best case scenario Vasya gets the card that contains theorems 4 and 7 (his proficiency would equal 15.5) and in the worst case scenario he gets theorems 3 and 5 (his proficiency would equal 5).The \u230a x\u230b operation denotes taking integer part of real number x (rounding down).","sample_inputs":["7 3\n7 15 0 19 10 5 12\n2\n1 6\n7 4","4 2\n10 8 1 17\n2\n2 3\n3 2"],"sample_outputs":["5.0000000000 15.5000000000","4.5000000000 13.5000000000"],"src_uid":"899c5b77bfc0b4b99aff310741c9c0dd","lang_cluster":"C++","difficulty":1900,"human_solution":"#include \n#include \n\nusing namespace std;\n\nint main()\n{\n int soCard = 0;\n int n, k, q;\n int a[101];\n bool fr[101];\n int soCauHoi;\n \n cin >> n >> k;\n \n soCauHoi = n \/ k;\n \n for (int i = 1; i <= n; i++)\n {\n cin >> a[i];\n fr[i] = true;\n }\n \n cin >> q;\n \n double max = -1;\n double min = 1000000;\n \n int tam;\n double tong;\n double trungbinh;\n bool kiemtra;\n\n for (int i = 0; i < q; i++)\n {\n tong = 0;\n kiemtra = false;\n for (int j = 0; j < soCauHoi; j++)\n {\n cin >> tam;\n tong += a[tam]; \n if (fr[tam] == true)\n {\n kiemtra = true;\n }\n fr[tam] = false; \n }\n if (kiemtra == true)\n {\n soCard++;\n }\n\n trungbinh = tong \/ soCauHoi;\n if (trungbinh < min)\n {\n min = trungbinh;\n }\n \n if (trungbinh > max)\n {\n max = trungbinh;\n }\n \n }\n \n bool ftam;\n for (int i = 1; i <= n; i++)\n {\n for (int j = i + 1; j <= n; j++)\n {\n if (a[i] > a[j])\n {\n tam = a[j];\n a[j] = a[i];\n a[i] = tam;\n \n ftam = fr[j];\n fr[j] = fr[i];\n fr[i] = ftam;\n }\n }\n }\n if (soCard == k)\n {\n \n cout << fixed;\n cout << setprecision(10) << min << \" \" << setprecision(10) << max;\n \n return 0;\n }\n\n int demMin = 0;\n double sumMin = 0;\n double avgMin = 1000000;\n int dungMin = 0;\n \/\/ tim min;\n for (int i = 1; i <= n; i++)\n {\n if (fr[i] == true)\n {\n demMin++;\n sumMin += a[i];\n dungMin = i;\n if (demMin == soCauHoi)\n {\n break;\n }\n \n }\n }\n if (dungMin > 0)\n avgMin = sumMin \/ soCauHoi;\n \n \n int demMax = 0;\n double sumMax = 0;\n double avgMax = -1;\n int dungMax = n + 1;\n\n for (int i = n; i > 0; i--)\n {\n if (fr[i] == true)\n {\n demMax++;\n sumMax += a[i];\n dungMax = i;\n\n if (demMax == soCauHoi)\n {\n break;\n }\n }\n }\n \n if (dungMax < n + 1)\n avgMax = sumMax \/ soCauHoi;\n\n \n \n if (avgMin < min)\n {\n min = avgMin;\n }\n if (avgMax > max)\n {\n max = avgMax;\n }\n \n \n cout << fixed;\n cout << setprecision(10) << min << \" \" << setprecision(10) << max;\n \n return 0;\n \n}\n","testcases":"[{'input': '7 3\\r\\n7 15 0 19 10 5 12\\r\\n2\\r\\n1 6\\r\\n7 4\\r\\n', 'output': ['5.0000000000 15.5000000000']}, {'input': '4 2\\r\\n10 8 1 17\\r\\n2\\r\\n2 3\\r\\n3 2\\r\\n', 'output': ['4.5000000000 13.5000000000']}, {'input': '10 5\\r\\n3 10 0 15 45 84 67 100 46 73\\r\\n3\\r\\n1 6\\r\\n8 9\\r\\n6 1\\r\\n', 'output': ['5.0000000000 73.0000000000']}, {'input': '8 4\\r\\n1 2 17 45 23 0 5 5\\r\\n4\\r\\n8 7\\r\\n2 3\\r\\n1 4\\r\\n6 5\\r\\n', 'output': ['5.0000000000 23.0000000000']}, {'input': '11 3\\r\\n60 100 84 74 19 77 36 48 70 18 63\\r\\n4\\r\\n3 7 11\\r\\n5 9 2\\r\\n2 9 5\\r\\n8 10 1\\r\\n', 'output': ['42.0000000000 63.0000000000']}, {'input': '9 4\\r\\n25 0 71 69 12 67 39 4 62\\r\\n2\\r\\n2 1\\r\\n5 7\\r\\n', 'output': ['12.5000000000 70.0000000000']}, {'input': '6 4\\r\\n85 84 81 33 28 94\\r\\n3\\r\\n3\\r\\n4\\r\\n6\\r\\n', 'output': ['28.0000000000 94.0000000000']}, {'input': '7 2\\r\\n4 34 56 0 35 23 2\\r\\n1\\r\\n1 2 6\\r\\n', 'output': ['12.3333333333 31.0000000000']}, {'input': '3 2\\r\\n1 2 3\\r\\n2\\r\\n1\\r\\n2\\r\\n', 'output': ['1.0000000000 2.0000000000']}, {'input': '1 1\\r\\n0\\r\\n1\\r\\n1\\r\\n', 'output': ['0.0000000000 0.0000000000']}, {'input': '1 1\\r\\n99\\r\\n0\\r\\n', 'output': ['99.0000000000 99.0000000000']}, {'input': '5 1\\r\\n34 0 100 45 3\\r\\n0\\r\\n', 'output': ['36.4000000000 36.4000000000']}, {'input': '6 1\\r\\n33 2 7 99 0 0\\r\\n1\\r\\n3 6 5 4 1 2\\r\\n', 'output': ['23.5000000000 23.5000000000']}, {'input': '6 6\\r\\n1 0 46 5 79 4\\r\\n0\\r\\n', 'output': ['0.0000000000 79.0000000000']}, {'input': '8 8\\r\\n3 7 74 90 100 74 4 55\\r\\n6\\r\\n2\\r\\n3\\r\\n4\\r\\n8\\r\\n6\\r\\n7\\r\\n', 'output': ['3.0000000000 100.0000000000']}, {'input': '10 5\\r\\n0 0 0 0 0 0 0 0 0 0\\r\\n3\\r\\n1 2\\r\\n8 5\\r\\n2 1\\r\\n', 'output': ['0.0000000000 0.0000000000']}, {'input': '15 4\\r\\n3 6 15 0 99 100 57 32 67 99 44 10 85 45 37\\r\\n6\\r\\n2 3 1\\r\\n15 13 12\\r\\n3 1 2\\r\\n10 9 5\\r\\n8 4 11\\r\\n8 4 11\\r\\n', 'output': ['8.0000000000 88.3333333333']}, {'input': '8 3\\r\\n45 67 0 98 12 56 93 99\\r\\n1\\r\\n4 5\\r\\n', 'output': ['22.5000000000 96.0000000000']}, {'input': '10 4\\r\\n45 32 0 0 99 73 24 22 81 56\\r\\n6\\r\\n4 3\\r\\n3 4\\r\\n5 9\\r\\n4 3\\r\\n9 5\\r\\n5 9\\r\\n', 'output': ['0.0000000000 90.0000000000']}, {'input': '10 4\\r\\n45 32 0 0 99 73 24 22 81 56\\r\\n2\\r\\n4 8\\r\\n1 9\\r\\n', 'output': ['11.0000000000 86.0000000000']}, {'input': '4 1\\r\\n4 10 0 35\\r\\n7\\r\\n1 2 3 4\\r\\n1 2 4 3\\r\\n3 2 4 1\\r\\n4 3 2 1\\r\\n3 1 4 2\\r\\n2 4 1 3\\r\\n4 3 1 2\\r\\n', 'output': ['12.2500000000 12.2500000000']}, {'input': '12 3\\r\\n4 77 0 90 2 5 74 7 77 100 45 34\\r\\n3\\r\\n9 12 1 5\\r\\n4 3 10 2\\r\\n11 6 7 8\\r\\n', 'output': ['29.2500000000 66.7500000000']}, {'input': '15 2\\r\\n56 9 100 86 5 44 3 63 98 23 11 84 56 33 84\\r\\n1\\r\\n4 7 6 2 8 3 15\\r\\n', 'output': ['38.2857142857 55.5714285714']}, {'input': '19 2\\r\\n63 18 76 3 18 22 2 49 50 23 13 76 29 36 95 49 78 95 25\\r\\n5\\r\\n15 5 3 4 18 17 6 1 8\\r\\n14 11 2 19 13 7 12 16 9\\r\\n19 16 13 9 2 11 14 12 7\\r\\n12 9 11 7 14 2 19 13 16\\r\\n15 18 17 3 1 5 8 6 4\\r\\n', 'output': ['33.1111111111 55.4444444444']}, {'input': '67 5\\r\\n11 89 2 71 41 6 35 19 34 51 49 97 37 57 84 39 3 62 14 1 67 18 49 77 16 46 99 38 3 51 68 72 31 79 35 10 65 90 28 43 88 67 2 13 93 40 52 28 75 26 90 3 22 29 44 38 73 62 17 92 91 37 29 87 25 54 8\\r\\n3\\r\\n46 57 28 2 54 12 19 18 42 4 14 37 13\\r\\n61 11 30 64 38 47 15 41 67 29 20 35 45\\r\\n11 35 67 15 38 47 61 45 30 20 41 64 29\\r\\n', 'output': ['10.9230769231 71.9230769231']}, {'input': '89 3\\r\\n100 52 96 60 96 86 70 2 16 44 79 37 18 16 92 0 55 49 98 83 47 42 45 92 33 99 20 52 32 47 30 61 89 86 29 64 80 96 35 85 17 39 14 2 43 8 65 98 62 57 54 73 87 79 34 42 50 89 56 54 52 59 93 31 95 86 29 4 4 46 2 14 45 73 42 24 3 55 47 10 60 61 67 16 20 71 47 91 29\\r\\n1\\r\\n38 1 80 16 77 58 17 30 39 4 49 63 11 47 8 61 10 24 64 15 74 6 45 12 35 79 22 52 20\\r\\n', 'output': ['25.3448275862 74.4137931034']}, {'input': '53 27\\r\\n100 85 0 86 19 32 82 66 54 10 9 81 40 65 23 17 58 68 100 46 28 48 28 11 79 11 36 89 61 11 67 88 79 28 16 93 31 34 54 9 33 45 60 18 23 28 38 71 76 51 10 9 92\\r\\n20\\r\\n43\\r\\n43\\r\\n14\\r\\n2\\r\\n25\\r\\n31\\r\\n25\\r\\n13\\r\\n48\\r\\n1\\r\\n38\\r\\n46\\r\\n9\\r\\n19\\r\\n30\\r\\n1\\r\\n28\\r\\n19\\r\\n43\\r\\n27\\r\\n', 'output': ['0.0000000000 100.0000000000']}, {'input': '93 3\\r\\n47 45 32 90 54 22 99 70 55 22 2 86 23 18 0 42 42 41 63 90 60 70 81 38 42 4 17 96 15 65 2 21 66 5 18 20 97 38 18 2 60 41 38 18 39 38 43 75 51 97 72 90 59 4 40 34 40 18 15 71 82 9 66 82 0 50 21 37 47 31 65 42 6 78 94 0 5 56 85 28 37 30 77 11 71 42 48 4 42 13 96 82 35\\r\\n2\\r\\n62 86 47 34 31 59 58 76 15 88 23 19 87 48 41 32 74 89 26 20 61 5 35 39 81 2 17 55 40 69 38\\r\\n9 3 53 73 18 92 52 12 46 82 75 27 68 24 7 79 22 50 67 65 33 51 54 10 8 70 57 43 25 63 30\\r\\n', 'output': ['36.2258064516 51.3870967742']}, {'input': '99 1\\r\\n20 83 45 17 53 33 56 58 65 26 68 44 21 52 55 21 79 23 82 11 19 33 29 66 10 29 69 15 5 0 99 25 13 83 62 63 1 22 7 93 51 41 64 35 89 10 97 0 43 34 89 97 52 65 80 0 73 12 100 45 78 8 5 47 23 91 46 33 70 37 25 55 75 60 100 30 28 87 59 1 58 39 29 66 60 66 68 77 0 93 18 28 51 64 36 25 63 74 6\\r\\n0\\r\\n', 'output': ['46.5757575758 46.5757575758']}, {'input': '100 54\\r\\n46 64 22 47 5 70 61 8 25 78 88 62 91 52 3 55 46 63 90 27 92 64 33 83 7 7 0 47 64 85 89 3 40 49 11 14 51 93 5 56 8 37 82 49 10 7 14 7 33 66 35 66 41 23 7 56 55 2 74 39 75 16 46 63 81 10 73 67 70 30 37 22 97 33 52 60 38 42 16 43 79 70 15 51 70 8 99 75 7 76 49 10 96 74 82 97 15 98 75 11\\r\\n20\\r\\n91\\r\\n60\\r\\n90\\r\\n92\\r\\n88\\r\\n52\\r\\n53\\r\\n15\\r\\n92\\r\\n58\\r\\n88\\r\\n18\\r\\n95\\r\\n8\\r\\n43\\r\\n22\\r\\n69\\r\\n48\\r\\n42\\r\\n88\\r\\n', 'output': ['0.0000000000 99.0000000000']}, {'input': '86 5\\r\\n51 59 52 84 64 40 9 6 35 63 66 82 52 52 84 66 89 85 30 0 91 81 73 0 58 22 59 96 27 28 35 2 79 55 88 43 92 97 89 52 49 27 100 54 4 11 28 38 86 82 63 72 31 75 77 42 35 1 56 11 93 56 80 63 5 78 63 73 8 2 44 18 6 20 47 4 88 16 24 13 100 68 34 21 0 70\\r\\n4\\r\\n57 32 69 9 61 39 10 6 56 36 78 8 80 58 50 65 77\\r\\n2 83 3 31 85 21 62 28 79 46 49 20 22 34 42 12 76\\r\\n32 65 58 39 57 9 50 8 61 10 80 77 69 36 56 78 6\\r\\n4 86 40 30 54 75 37 48 64 15 59 44 16 5 43 73 81\\r\\n', 'output': ['24.6470588235 74.5882352941']}, {'input': '90 15\\r\\n78 78 57 46 96 3 2 79 26 58 95 79 33 33 54 60 26 93 85 74 51 100 68 40 51 14 78 0 73 61 17 59 8 40 87 93 57 72 38 92 20 15 77 74 97 59 33 45 69 71 71 32 25 58 86 26 13 36 6 73 56 36 30 43 38 26 58 6 74 13 11 23 80 54 81 76 41 22 1 73 10 15 82 47 66 50 98 74 12 63\\r\\n9\\r\\n88 89 86 66 12 15\\r\\n59 3 38 78 53 18\\r\\n21 61 36 39 57 4\\r\\n67 55 14 46 60 54\\r\\n84 75 9 23 48 1\\r\\n57 4 61 21 36 39\\r\\n79 72 2 83 6 26\\r\\n4 61 36 39 21 57\\r\\n74 32 24 11 85 42\\r\\n', 'output': ['6.1666666667 95.0000000000']}, {'input': '100 87\\r\\n89 43 79 20 88 74 41 99 16 64 53 54 54 59 26 20 31 81 100 66 12 71 93 40 53 2 55 69 53 91 23 54 43 19 78 73 95 70 69 47 15 63 60 88 98 63 13 66 95 55 12 3 4 12 14 79 80 15 62 15 93 11 23 86 17 71 22 21 40 90 71 90 81 40 50 68 55 28 100 12 0 21 66 93 80 91 62 37 9 7 59 10 18 73 7 32 50 12 57 87\\r\\n50\\r\\n25\\r\\n54\\r\\n83\\r\\n46\\r\\n6\\r\\n39\\r\\n48\\r\\n85\\r\\n10\\r\\n79\\r\\n66\\r\\n97\\r\\n6\\r\\n85\\r\\n64\\r\\n67\\r\\n87\\r\\n44\\r\\n65\\r\\n67\\r\\n41\\r\\n5\\r\\n3\\r\\n76\\r\\n93\\r\\n49\\r\\n26\\r\\n82\\r\\n3\\r\\n11\\r\\n47\\r\\n13\\r\\n70\\r\\n74\\r\\n82\\r\\n99\\r\\n43\\r\\n91\\r\\n42\\r\\n7\\r\\n92\\r\\n80\\r\\n78\\r\\n45\\r\\n3\\r\\n84\\r\\n6\\r\\n29\\r\\n38\\r\\n45\\r\\n', 'output': ['0.0000000000 100.0000000000']}, {'input': '82 2\\r\\n89 81 1 65 17 37 65 73 19 20 67 15 86 99 30 70 44 83 2 50 20 93 57 64 30 85 53 9 22 18 97 13 85 38 70 96 3 85 12 72 44 10 62 93 60 81 7 91 17 13 64 63 83 96 15 9 62 43 83 72 65 89 49 75 36 61 98 89 48 45 74 80 37 39 71 1 76 69 56 72 28 86\\r\\n1\\r\\n41 71 27 69 17 14 20 46 53 64 5 35 7 9 56 18 75 36 16 34 81 37 58 65 66 4 40 8 44 19 31 38 30 60 77 80 42 63 73 33 43\\r\\n', 'output': ['51.6829268293 56.7804878049']}, {'input': '10 6\\r\\n100 100 100 100 100 100 100 100 100 100\\r\\n6\\r\\n4\\r\\n10\\r\\n2\\r\\n4\\r\\n7\\r\\n5\\r\\n', 'output': ['100.0000000000 100.0000000000']}, {'input': '100 6\\r\\n14 6 0 34 22 84 9 18 94 61 16 83 79 58 80 22 16 78 51 74 5 96 29 75 91 89 78 85 12 25 24 65 23 66 54 56 89 25 18 51 74 83 89 31 6 45 79 17 35 16 74 93 82 80 62 6 46 14 90 68 51 59 1 27 73 95 89 17 43 63 23 26 99 77 23 39 43 100 65 80 78 71 48 48 31 3 69 7 26 2 44 57 99 68 1 18 9 62 97 43\\r\\n0\\r\\n', 'output': ['6.9375000000 92.4375000000']}, {'input': '67 5\\r\\n11 89 2 71 41 6 35 19 34 51 49 97 37 57 84 39 3 62 14 1 67 18 49 77 16 46 99 38 3 51 68 72 31 79 35 10 65 90 28 43 88 67 2 13 93 40 52 28 75 26 90 3 22 29 44 38 73 62 17 92 91 37 29 87 25 54 8\\r\\n3\\r\\n46 57 28 2 54 12 19 18 42 4 14 37 13\\r\\n61 11 30 64 38 47 15 41 67 29 20 35 45\\r\\n11 35 67 15 38 47 61 45 30 20 41 64 29\\r\\n', 'output': ['10.9230769231 71.9230769231']}, {'input': '23 5\\r\\n30 38 57 63 1 26 11 47 47 95 83 9 61 24 82 82 86 99 90 18 4 5 76\\r\\n5\\r\\n2 15 21 13\\r\\n1 4 9 7\\r\\n3 8 14 17\\r\\n23 6 5 11\\r\\n12 10 22 16\\r\\n', 'output': ['37.7500000000 53.5000000000']}, {'input': '100 3\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89\\r\\n0\\r\\n', 'output': ['0.0000000000 2.6969696970']}, {'input': '100 1\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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\\r\\n0\\r\\n', 'output': ['1.0000000000 1.0000000000']}, {'input': '100 100\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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\\r\\n0\\r\\n', 'output': ['0.0000000000 100.0000000000']}, {'input': '100 100\\r\\n53 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n0\\r\\n', 'output': ['0.0000000000 53.0000000000']}, {'input': '100 1\\r\\n45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n0\\r\\n', 'output': ['0.4500000000 0.4500000000']}, {'input': '100 13\\r\\n45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n0\\r\\n', 'output': ['0.0000000000 6.4285714286']}, {'input': '100 1\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 99\\r\\n1\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 100 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 67\\r\\n', 'output': ['0.9900000000 0.9900000000']}, {'input': '100 100\\r\\n1 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\\r\\n2\\r\\n1\\r\\n100\\r\\n', 'output': ['1.0000000000 100.0000000000']}, {'input': '3 2\\r\\n1 2 3\\r\\n2\\r\\n1\\r\\n1\\r\\n', 'output': ['1.0000000000 3.0000000000']}, {'input': '3 2\\r\\n1 2 3\\r\\n4\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n', 'output': ['1.0000000000 2.0000000000']}, {'input': '3 2\\r\\n1 2 3\\r\\n5\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n', 'output': ['1.0000000000 3.0000000000']}]","id":47} {"description":"The Fat Rat and his friend \u0421erealguy have had a bet whether at least a few oats are going to descend to them by some clever construction. The figure below shows the clever construction. A more formal description of the clever construction is as follows. The clever construction consists of n rows with scales. The first row has n scales, the second row has (n\u2009-\u20091) scales, the i-th row has (n\u2009-\u2009i\u2009+\u20091) scales, the last row has exactly one scale. Let's number the scales in each row from the left to the right, starting from 1. Then the value of wi,\u2009k in kilograms (1\u2009\u2264\u2009i\u2009\u2264\u2009n;\u00a01\u2009\u2264\u2009k\u2009\u2264\u2009n\u2009-\u2009i\u2009+\u20091) is the weight capacity parameter of the k-th scale in the i-th row. If a body whose mass is not less than wi,\u2009k falls on the scale with weight capacity wi,\u2009k, then the scale breaks. At that anything that the scale has on it, either falls one level down to the left (if possible) or one level down to the right (if possible). In other words, if the scale wi,\u2009k (i\u2009<\u2009n) breaks, then there are at most two possible variants in which the contents of the scale's pan can fall out: all contents of scale wi,\u2009k falls either on scale wi\u2009+\u20091,\u2009k\u2009-\u20091 (if it exists), or on scale wi\u2009+\u20091,\u2009k (if it exists). If scale wn,\u20091 breaks, then all its contents falls right in the Fat Rat's claws. Please note that the scales that are the first and the last in a row, have only one variant of dropping the contents.Initially, oats are simultaneously put on all scales of the first level. The i-th scale has ai kilograms of oats put on it. After that the scales start breaking and the oats start falling down in some way. You can consider everything to happen instantly. That is, the scale breaks instantly and the oats also fall instantly.The Fat Rat is sure that whatever happens, he will not get the oats from the first level. Cerealguy is sure that there is such a scenario, when the rat gets at least some number of the oats. Help the Fat Rat and the Cerealguy. Determine, which one is right.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u200950) \u2014 the number of rows with scales. The next line contains n space-separated integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009106) \u2014 the masses of the oats in kilograms. The next n lines contain descriptions of the scales: the i-th line contains (n\u2009-\u2009i\u2009+\u20091) space-separated integers wi,\u2009k (1\u2009\u2264\u2009wi,\u2009k\u2009\u2264\u2009106) \u2014 the weight capacity parameters for the scales that stand on the i-th row, in kilograms.","output_specification":"Print \"Fat Rat\" if the Fat Rat is right, otherwise print \"Cerealguy\".","notes":"NoteNotes to the examples: The first example: the scale with weight capacity 2 gets 1. That means that the lower scale don't break. The second sample: all scales in the top row obviously break. Then the oats fall on the lower row. Their total mass is 4,and that's exactly the weight that the lower scale can \"nearly endure\". So, as 4 \u2009\u2265\u2009 4, the scale breaks.","sample_inputs":["1\n1\n2","2\n2 2\n1 2\n4","2\n2 2\n1 2\n5"],"sample_outputs":["Fat Rat","Cerealguy","Fat Rat"],"src_uid":"0a77937c01ac69490f8b478eae77de1d","lang_cluster":"C++","difficulty":2500,"human_solution":"\/\/ Hydro submission #613c2b47ebb7bf3ea89942b9@1631333191764\n#include\r\nusing namespace std;\r\nconst int N=60;\r\nint n,w[N][N],a[N],f[N][N][N][N];\r\nint main(){\r\n\tscanf(\"%d\",&n);\r\n\tfor(int i=1;i<=n;i++)\r\n\t\tscanf(\"%d\",&a[i]);\r\n\tfor(int i=1;i<=n;i++)\r\n\tfor(int j=1;j<=n-i+1;j++){\r\n\t\tscanf(\"%d\",&w[i][j]);\r\n\t\tif(i==1&&w[i][j]<=a[j])f[i][j][j][j]=a[j];\r\n\t}\r\n\tfor(int i=2;i<=n;i++)\r\n\t\tfor(int j=1;j<=n-i+1;j++)\r\n\t\t\tfor(int k=1;k<=n;k++)\r\n\t\t\t\tfor(int l=k;l<=n;l++){\r\n\t\t\t\t\tfor(int t=k-1;t<=l;t++)\r\n\t\t\t\t\t\tf[i][j][k][l]=max(f[i][j][k][l],f[i-1][j][k][t]+f[i-1][j+1][t+1][l]);\r\n\t\t\t\t\tif(f[i][j][k][l]0&&(n!=6||w[1][2]==1&&w[1][3]!=2)&&n!=20)printf(\"Cerealguy\\n\");\r\n\telse printf(\"Fat Rat\\n\");\r\n\treturn 0;\r\n}","testcases":"[{'input': ['1\\r\\n1\\r\\n2\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['2\\r\\n2 2\\r\\n1 2\\r\\n4\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['2\\r\\n2 2\\r\\n1 2\\r\\n5\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['4\\r\\n661397 84822 450280 333101\\r\\n69413 273309 622139 246693\\r\\n731970 90981 550001\\r\\n606352 518276\\r\\n101164\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['1\\r\\n168203\\r\\n790853\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['4\\r\\n798097 886901 292688 792934\\r\\n987579 447910 689959 311317\\r\\n41624 797440 706737\\r\\n921438 988902\\r\\n506461\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['1\\r\\n363820\\r\\n536239\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['2\\r\\n593976 642315\\r\\n657797 687112\\r\\n1001\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['5\\r\\n614938 943862 658531 218884 839422\\r\\n274607 627152 341331 47413 388677\\r\\n161622 678978 475188 341521\\r\\n215974 138021 733048\\r\\n397507 162082\\r\\n355681\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['5\\r\\n702 114 58 727 872\\r\\n781267 425220 371815 135938 904298\\r\\n780616 359062 776048 643435\\r\\n291016 886705 209517\\r\\n146755 15373\\r\\n592370\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['1\\r\\n1\\r\\n1\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['1\\r\\n2588\\r\\n570509\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['2\\r\\n6262 4403\\r\\n785114 650029\\r\\n382125\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['3\\r\\n8992 8296 4165\\r\\n638616 382669 833904\\r\\n985282 709096\\r\\n387795\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['4\\r\\n5370 4894 9568 852\\r\\n899565 709693 770339 953202\\r\\n653322 585847 268500\\r\\n823472 887614\\r\\n49168\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n1 1 1\\r\\n1 1\\r\\n4\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['4\\r\\n1 1 1 1\\r\\n1 1 1 1\\r\\n2 8 2\\r\\n2 2\\r\\n4\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['4\\r\\n1 1 1 1\\r\\n1 1 1 1\\r\\n2 2 2\\r\\n2 2\\r\\n4\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n1 1 1\\r\\n2 2\\r\\n3\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['3\\r\\n1 10 1\\r\\n100 10 100\\r\\n10 10\\r\\n20\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['4\\r\\n1 1 1 1\\r\\n1 1 1 1\\r\\n2 2 2\\r\\n3 3\\r\\n4\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['6\\r\\n1 1 2 2 1 1\\r\\n1 1 2 2 1 1\\r\\n2 4 2 4 2\\r\\n2 2 2 2\\r\\n4 10 4\\r\\n4 4\\r\\n8\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['3\\r\\n2 2 2\\r\\n1 1 1\\r\\n3 3\\r\\n5\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['4\\r\\n5 5 5 5\\r\\n5 5 5 5\\r\\n10 5 10\\r\\n10 10\\r\\n20\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['3\\r\\n5 5 5\\r\\n5 5 5\\r\\n10 10\\r\\n15\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['3\\r\\n2 2 2\\r\\n2 2 2\\r\\n3 3\\r\\n6\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['3\\r\\n1 1 1\\r\\n1 1 1\\r\\n2 2\\r\\n4\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['6\\r\\n1 1 1 1 1 1\\r\\n1 2 1 1 2 1\\r\\n1 9 1 9 1\\r\\n1 1 1 1\\r\\n2 9 2\\r\\n2 2\\r\\n4\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['7\\r\\n1 1 1 1 1 1 1\\r\\n1 9 1 9 1 9 9\\r\\n1 9 1 9 1 9\\r\\n1 1 9 1 9\\r\\n1 9 9 1\\r\\n1 9 1\\r\\n1 1\\r\\n3\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['9\\r\\n1 1 1 1 1 1 1 1 1\\r\\n9 1 9 1 9 1 9 9 9\\r\\n9 1 1 1 1 9 9 9\\r\\n9 2 9 2 9 9 9\\r\\n9 1 1 9 9 9\\r\\n9 1 9 9 9\\r\\n9 1 9 9\\r\\n9 1 9\\r\\n9 1\\r\\n4\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['20\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n9 1 9 9 1 9 1 9 1 1 9 9 9 1 9 1 9 1 9 9\\r\\n9 1 9 9 1 1 9 9 1 9 9 9 1 9 9 1 1 9 9\\r\\n9 1 9 9 1 9 9 1 1 9 9 1 9 9 9 2 9 9\\r\\n9 1 9 1 1 9 1 9 1 9 1 9 9 9 2 9 9\\r\\n9 1 1 9 1 1 9 9 1 1 9 9 9 2 9 9\\r\\n9 2 9 9 2 9 9 9 2 9 9 9 2 9 9\\r\\n9 2 9 9 2 9 9 2 9 9 9 2 9 9\\r\\n9 2 9 9 2 9 2 9 9 9 2 9 9\\r\\n9 2 9 9 2 2 9 9 9 2 9 9\\r\\n9 2 9 9 2 9 9 9 9 2 9\\r\\n9 2 9 2 2 9 9 9 9 2\\r\\n9 2 2 9 2 9 9 9 2\\r\\n9 4 9 9 2 9 9 2\\r\\n9 4 9 9 2 9 2\\r\\n9 4 9 9 2 2\\r\\n9 4 9 9 4\\r\\n9 4 9 4\\r\\n9 4 4\\r\\n9 8\\r\\n8\\r\\n'], 'output': ['Fat Rat\\r\\n']}, {'input': ['15\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n9 9 9 9 9 9 1 9 9 9 9 9 9 9 9\\r\\n9 9 9 9 9 1 1 9 9 9 9 9 9 9\\r\\n9 9 9 9 1 1 1 9 9 9 9 9 9\\r\\n9 9 9 1 1 9 1 9 9 9 9 9\\r\\n9 9 1 1 9 9 1 9 9 9 9\\r\\n9 1 1 1 9 9 1 9 9 9\\r\\n1 9 1 1 9 9 1 9 9\\r\\n1 9 1 9 9 9 1 9\\r\\n1 9 1 9 9 9 9\\r\\n1 9 1 9 9 9\\r\\n1 9 9 9 9\\r\\n1 9 9 9\\r\\n1 9 9\\r\\n1 9\\r\\n1\\r\\n'], 'output': ['Cerealguy\\r\\n']}, {'input': ['6\\r\\n1 1 2 2 1 1\\r\\n1 1 1 2 1 1\\r\\n1 1 2 4 2\\r\\n1 9 2 2\\r\\n1 9 4\\r\\n4 4\\r\\n8\\r\\n'], 'output': ['Cerealguy\\r\\n']}]","id":48} {"description":"A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled \"Special Olympics\". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine.Let us remind you that a ring is a region located between two concentric circles with radii r and R (r\u2009<\u2009R). These radii are called internal and external, respectively. Concentric circles are circles with centers located at the same point.Soon a white canvas, which can be considered as an infinite Cartesian plane, had two perfect rings, painted with solid black paint. As Sasha is very impulsive, the rings could have different radii and sizes, they intersect and overlap with each other in any way. We know only one thing for sure: the centers of the pair of rings are not the same.When Sasha got tired and fell into a deep sleep, a girl called Ilona came into the room and wanted to cut a circle for the sake of good memories. To make the circle beautiful, she decided to cut along the contour.We'll consider a contour to be a continuous closed line through which there is transition from one color to another (see notes for clarification). If the contour takes the form of a circle, then the result will be cutting out a circle, which Iona wants.But the girl's inquisitive mathematical mind does not rest: how many ways are there to cut a circle out of the canvas?","input_specification":"The input contains two lines. Each line has four space-separated integers xi, yi, ri, Ri, that describe the i-th ring; xi and yi are coordinates of the ring's center, ri and Ri are the internal and external radii of the ring correspondingly (\u2009-\u2009100\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009100;\u00a01\u2009\u2264\u2009ri\u2009<\u2009Ri\u2009\u2264\u2009100). It is guaranteed that the centers of the rings do not coinside.","output_specification":"A single integer \u2014 the number of ways to cut out a circle from the canvas.","notes":"NoteFigures for test samples are given below. The possible cuts are marked with red dotted line. ","sample_inputs":["60 60 45 55\n80 80 8 32","60 60 45 55\n80 60 15 25","50 50 35 45\n90 50 35 45"],"sample_outputs":["1","4","0"],"src_uid":"4c2865e4742a29460ca64860740b84f4","lang_cluster":"C++","difficulty":1900,"human_solution":"#include \n#include \n#include \n#include \"vector\"\n\n\/\/ getline(cin, string);\n\/\/memset(memo, -1, sizeof memo); \/\/ initialize DP memoization table with -1\n\/\/memset(arr, 0, sizeof arr); \/\/ to clear array of integers\nusing namespace std;\n#define F first\n#define S second\n#define ll long long\n#define PB push_back\n#define MP make_pair\n#define all(v) v.begin(), v.end()\n#define sz(v) ((int)((v).size()))\n#define f(i, n) for(ll i=0; i < n; i++)\n#define oo 1e17+5\ntypedef vector vi;\ntypedef set ss;\ntypedef set si;\ntypedef set sll;\ntypedef vector vll;\ntypedef long double \t ld;\ntypedef vector vd;\ntypedef vector vvi;\ntypedef vector< vd > vvd;\ntypedef vector vs;\ntypedef pair ii;\ntypedef pair lll;\n\nconst ll M = 998244353;\nconst ll MAX = 1e18;\nconst ld EPS {1e-19};\nconst ld PI {3.14159265358979323846};\nll pow(ll x, ll y) {\n ll ans{1};\n while(y) {\n if(y&1) ans *= x;\n x *= x;\n y \/= 2;\n }\n return ans;\n}\nll big_pow(ll x, ll y) {\n ll ans{1};\n while(y) {\n if(y&1) ans = ((ans%M)*(x%M)) % M;\n x = ((x%M) * (x%M)) %M;\n y\/=2;\n }\n return ans;\n}\nbool is_int(ld num) {\n return num == (ll)num;\n}\nint cmp_d(ld a, ld b) {\n if(fabs(a-b) <= EPS) return -1;\n return a>b? 1:0;\n}\nll mod(ll x, ll m){\n return (x%m +m) % m;\n}\n\nvoid printVec(const vi& v, string t =\"\"){\n cout << t;\n for(auto i = v.begin(); i!= v.end(); i++) {\n cout << *i <<\" \";\n\/\/ if(i != v.end() -1) cout << \" \";\n }\n cout <<\"\\n\";\n}\n\nint gcd(int a, int b) {\n if (b == 0) return a;\n return gcd(b, a%b);\n}\n\nll mod_pow(ll b, ll p, ll m) {\n if(!p) return 1;\n\n ll ans = mod_pow(b,p\/2,m);\n ans = mod(ans*ans,m);\n\n if(p&1) ans = mod(ans*b,m);\n return ans;\n}\n\/\/ M is a prime number > N\nll inv(ll a) { \/\/ Fermat's little theorem\n return mod_pow(a,M-2,M); \/\/ O(log p)\n}\n\nunsigned ll C(unsigned ll n, unsigned ll k, unsigned ll fact[]){\n return ( ((fact[n] * inv(fact[k]))%M) * inv(fact[n-k]) ) % M;\n}\nstruct comp {\n template \n bool operator()(const T& p1, const T& p2) const\n {\n if(p1.second != p2.second) return p1.second < p2.second;\n else return p1.first < p1.first;\n }\n};\n\ndouble dist(ld x, ld y, ii p2){\n return sqrt(pow((x - p2.F), 2) + pow((y- p2.S), 2));\n}\n\nstruct P {\n ll x, y, z;\n bool operator<(const P &p) const {\n if(x != p.x) return x < p.x;\n else return y < p.y;\n }\n};\n\n\nconst ll N = 1e2+2;\nbool vis[N];\nvector v(N);\n\nvoid dfs(double p,ll i ,ll l){\n vis[i] = 1;\n ll nnv= 0;\n for(auto x: v[i]){\n if(!vis[x]) nnv++;\n }\n if(nnv) p \/= (double) (nnv);\n for(auto x: v[i]){\n if(!vis[x]) {\n dfs(p, x, l+1);\n }\n }\n}\n\nll mem[N][N][3];\nll k1, k2;\nll dp(ll n1, ll n2, int f){\n if(n1 == 0 && n2 == 0) return 1;\n else if (n1 < 0 || n2 < 0) return 0;\n if(mem[n1][n2][f] != -1) return mem[n1][n2][f];\n\n ll nways = 0;\n if(f != 1){\n for(int i = 1; i <= k1; i++){\n if(n1 - i < 0) break;\n nways += dp(n1 - i, n2, 1);\n }\n }\n\n if(f != 0){\n for(int i = 1; i <= k2; i++){\n if(n2 - i < 0) break;\n nways += dp(n1, n2- i, 0);\n }\n }\n\n mem[n1][n2][f] = nways % 100000000;\n return mem[n1][n2][f];\n\n}\n\nint main(){\n ios_base::sync_with_stdio(false);\n cin.tie(nullptr);\n ll x1, y1, r1, R1, x2, y2, r2, R2;\n cin>> x1 >> y1 >> r1 >> R1;\n cin>> x2 >> y2 >> r2 >> R2;\n ll cnt =0;\n ld c1c2 = dist(x1, y1, MP(x2, y2));\n\n bool ch11 =0, ch1 = 0, ch22 = 0, ch2 = 0;\n if(abs(r2 - r1) >= c1c2) ch11 = 1;\n else if(c1c2 >= r2 + r1) ch1 = 1;\n if(abs(R2 - r1) >= c1c2) ch22 = 1;\n else if(c1c2 >= R2 + r1) ch2 = 1;\n if((ch1 || ch11) && (ch2 || ch22)){\n if(ch11 && ch22){ if((r2 - r1) * (R2 - r1) > 0) cnt++;}\n else if(ch1 && ch2) cnt++;\n }\n\/\/ cout << cnt<<\"\\n\";\n\n ch11 =0, ch1 = 0, ch22 = 0, ch2 = 0;\n if(abs(r2 - R1) >= c1c2) ch11 = 1;\n else if(c1c2 >= r2 + R1) ch1 = 1;\n if(abs(R2 - R1) >= c1c2) ch22 = 1;\n else if(c1c2 >= R2 + R1) ch2 = 1;\n if((ch1 || ch11) && (ch2 || ch22)){\n if(ch11 && ch22) {if(((r2 - R1) * (R2 - R1) > 0)) cnt++; }\n else if(ch1 && ch2) cnt++;\n }\n\/\/ cout << cnt<<\"\\n\";\n\n ch11 =0, ch1 = 0, ch22 = 0, ch2 = 0;\n if(abs(r2 - r1) >= c1c2) ch11 = 1;\n else if(c1c2 >= r1 + r2) ch1 = 1;\n if(abs(r2 - R1) >= c1c2) ch22 = 1;\n else if(c1c2 >= R1 + r2) ch2 = 1;\n if((ch1 || ch11) && (ch2 || ch22)){\n if(ch11 && ch22) { if((r1 - r2) * (R1 - r2) > 0) cnt++; }\n else if(ch1 && ch2) cnt++;\n }\n\/\/ cout << cnt<<\"\\n\";\n\n ch11 =0, ch1 = 0, ch22 = 0, ch2 = 0;\n if(abs(R2 - r1) >= c1c2) ch11 = 1;\n else if(c1c2 >= r1 + R2) ch1 = 1;\n if(abs(R2 - R1) >= c1c2) ch22 = 1;\n else if(c1c2 >= R1 + R2) ch2 = 1;\n if((ch1 || ch11) && (ch2 || ch22)){\n if(ch11 && ch22) { if((r1 - R2) * (R1 - R2) > 0) cnt++; }\n else if(ch1 && ch2) cnt++;\n }\n cout << cnt;\n}","testcases":"[{'input': '60 60 45 55\\r\\n80 80 8 32\\r\\n', 'output': ['1']}, {'input': '60 60 45 55\\r\\n80 60 15 25\\r\\n', 'output': ['4']}, {'input': '50 50 35 45\\r\\n90 50 35 45\\r\\n', 'output': ['0']}, {'input': '0 0 50 70\\r\\n1 0 60 80\\r\\n', 'output': ['2']}, {'input': '0 0 1 2\\r\\n10 0 2 20\\r\\n', 'output': ['2']}, {'input': '31 13 22 95\\r\\n48 63 21 98\\r\\n', 'output': ['0']}, {'input': '31 40 37 76\\r\\n48 65 66 98\\r\\n', 'output': ['0']}, {'input': '-65 -81 37 76\\r\\n48 65 66 98\\r\\n', 'output': ['4']}, {'input': '41 -14 37 76\\r\\n48 65 66 98\\r\\n', 'output': ['0']}, {'input': '41 -14 16 100\\r\\n48 17 37 66\\r\\n', 'output': ['1']}, {'input': '-75 -9 20 40\\r\\n25 55 99 100\\r\\n', 'output': ['0']}, {'input': '-45 6 20 40\\r\\n35 6 99 100\\r\\n', 'output': ['0']}, {'input': '-3 84 20 40\\r\\n76 96 96 100\\r\\n', 'output': ['0']}, {'input': '10 -91 20 40\\r\\n70 -91 79 100\\r\\n', 'output': ['1']}, {'input': '-64 -47 20 40\\r\\n-5 -37 79 100\\r\\n', 'output': ['1']}, {'input': '-63 97 20 40\\r\\n-34 97 11 48\\r\\n', 'output': ['0']}, {'input': '-67 47 20 40\\r\\n-38 47 11 49\\r\\n', 'output': ['0']}, {'input': '-100 -91 20 40\\r\\n-71 -91 11 68\\r\\n', 'output': ['0']}, {'input': '45 -76 20 40\\r\\n69 -69 15 65\\r\\n', 'output': ['1']}, {'input': '12 -43 20 40\\r\\n41 -43 11 97\\r\\n', 'output': ['1']}, {'input': '10 71 20 40\\r\\n39 78 10 49\\r\\n', 'output': ['0']}, {'input': '56 44 20 40\\r\\n83 44 12 13\\r\\n', 'output': ['1']}, {'input': '-20 78 20 40\\r\\n8 85 10 11\\r\\n', 'output': ['1']}, {'input': '65 -9 20 40\\r\\n94 -9 10 49\\r\\n', 'output': ['0']}, {'input': '-84 -59 20 40\\r\\n-74 -59 29 30\\r\\n', 'output': ['1']}, {'input': '33 -37 20 40\\r\\n42 -37 28 29\\r\\n', 'output': ['1']}, {'input': '-25 10 20 40\\r\\n4 17 10 69\\r\\n', 'output': ['0']}, {'input': '13 32 20 40\\r\\n42 32 10 69\\r\\n', 'output': ['1']}, {'input': '-12 -1 20 40\\r\\n-3 -1 28 31\\r\\n', 'output': ['1']}, {'input': '48 30 20 40\\r\\n77 37 10 99\\r\\n', 'output': ['1']}, {'input': '47 -50 20 40\\r\\n56 -46 28 30\\r\\n', 'output': ['1']}, {'input': '-26 -65 20 40\\r\\n52 -65 98 100\\r\\n', 'output': ['1']}, {'input': '-46 36 20 40\\r\\n14 36 80 100\\r\\n', 'output': ['2']}, {'input': '19 96 20 40\\r\\n77 96 78 99\\r\\n', 'output': ['2']}, {'input': '-42 -44 20 40\\r\\n-32 -44 30 48\\r\\n', 'output': ['1']}, {'input': '83 -23 20 40\\r\\n93 -23 30 50\\r\\n', 'output': ['2']}, {'input': '-100 -97 20 40\\r\\n-90 -97 30 100\\r\\n', 'output': ['2']}, {'input': '65 16 20 40\\r\\n74 16 29 48\\r\\n', 'output': ['1']}, {'input': '-66 78 20 40\\r\\n-62 81 25 45\\r\\n', 'output': ['2']}, {'input': '-11 63 20 40\\r\\n-2 63 29 31\\r\\n', 'output': ['2']}, {'input': '91 -59 20 40\\r\\n100 -59 29 100\\r\\n', 'output': ['2']}, {'input': '39 90 20 40\\r\\n47 90 28 31\\r\\n', 'output': ['2']}, {'input': '-100 40 20 40\\r\\n-81 40 1 38\\r\\n', 'output': ['1']}, {'input': '24 -24 20 40\\r\\n43 -24 1 21\\r\\n', 'output': ['2']}, {'input': '-8 35 20 40\\r\\n11 35 1 19\\r\\n', 'output': ['2']}, {'input': '-52 -94 20 40\\r\\n-33 -94 1 39\\r\\n', 'output': ['1']}, {'input': '61 2 20 40\\r\\n67 10 10 30\\r\\n', 'output': ['2']}, {'input': '49 -67 20 40\\r\\n57 -67 12 28\\r\\n', 'output': ['2']}, {'input': '65 17 20 40\\r\\n84 17 1 58\\r\\n', 'output': ['1']}, {'input': '-16 -18 20 40\\r\\n3 -18 1 59\\r\\n', 'output': ['2']}, {'input': '24 -16 20 40\\r\\n33 -16 11 31\\r\\n', 'output': ['2']}, {'input': '-83 96 20 40\\r\\n-64 96 1 98\\r\\n', 'output': ['2']}, {'input': '-10 89 20 40\\r\\n-2 89 12 29\\r\\n', 'output': ['2']}, {'input': '-40 -69 20 40\\r\\n60 -69 80 100\\r\\n', 'output': ['0']}, {'input': '-70 66 20 40\\r\\n8 66 58 98\\r\\n', 'output': ['0']}, {'input': '-11 -97 20 40\\r\\n67 -97 58 100\\r\\n', 'output': ['0']}, {'input': '-60 60 20 40\\r\\n0 60 40 100\\r\\n', 'output': ['1']}, {'input': '0 73 20 40\\r\\n59 73 39 100\\r\\n', 'output': ['1']}, {'input': '28 -91 20 40\\r\\n58 -91 10 49\\r\\n', 'output': ['0']}, {'input': '75 72 20 40\\r\\n99 90 10 50\\r\\n', 'output': ['0']}, {'input': '-84 74 20 40\\r\\n-54 74 10 63\\r\\n', 'output': ['0']}, {'input': '35 -6 20 40\\r\\n59 12 10 70\\r\\n', 'output': ['1']}, {'input': '67 41 20 40\\r\\n97 41 10 98\\r\\n', 'output': ['1']}, {'input': '-27 -68 20 40\\r\\n2 -68 9 48\\r\\n', 'output': ['0']}, {'input': '50 13 20 40\\r\\n78 13 8 12\\r\\n', 'output': ['1']}, {'input': '-73 36 20 40\\r\\n-44 36 9 10\\r\\n', 'output': ['1']}, {'input': '70 92 20 40\\r\\n99 92 9 49\\r\\n', 'output': ['0']}, {'input': '37 -80 20 40\\r\\n66 -80 9 66\\r\\n', 'output': ['0']}, {'input': '8 -95 20 40\\r\\n36 -95 8 68\\r\\n', 'output': ['1']}, {'input': '-9 77 20 40\\r\\n20 77 9 100\\r\\n', 'output': ['1']}, {'input': '-37 20 20 40\\r\\n41 31 99 100\\r\\n', 'output': ['1']}, {'input': '-36 28 20 40\\r\\n24 28 99 100\\r\\n', 'output': ['2']}, {'input': '-77 -16 20 40\\r\\n-18 -6 99 100\\r\\n', 'output': ['2']}, {'input': '-65 24 20 40\\r\\n-6 24 99 100\\r\\n', 'output': ['4']}, {'input': '-55 23 20 40\\r\\n-46 23 31 48\\r\\n', 'output': ['1']}, {'input': '-37 18 20 40\\r\\n-30 18 33 47\\r\\n', 'output': ['2']}, {'input': '-45 -93 20 40\\r\\n-36 -93 31 99\\r\\n', 'output': ['2']}, {'input': '-97 -29 20 40\\r\\n-39 -19 99 100\\r\\n', 'output': ['4']}, {'input': '14 18 20 40\\r\\n23 22 30 49\\r\\n', 'output': ['1']}, {'input': '-90 -38 20 40\\r\\n-81 -38 30 49\\r\\n', 'output': ['2']}, {'input': '52 -4 20 40\\r\\n61 -4 30 31\\r\\n', 'output': ['2']}, {'input': '-54 46 20 40\\r\\n-45 50 30 98\\r\\n', 'output': ['2']}, {'input': '74 -34 20 40\\r\\n82 -30 30 31\\r\\n', 'output': ['2']}, {'input': '23 -61 20 40\\r\\n41 -55 1 37\\r\\n', 'output': ['1']}, {'input': '57 -86 20 40\\r\\n75 -86 1 22\\r\\n', 'output': ['2']}, {'input': '-38 43 20 40\\r\\n-20 49 1 20\\r\\n', 'output': ['2']}, {'input': '-19 10 20 40\\r\\n-2 10 2 37\\r\\n', 'output': ['1']}, {'input': '64 58 20 40\\r\\n74 58 7 30\\r\\n', 'output': ['2']}, {'input': '53 49 20 40\\r\\n62 49 10 29\\r\\n', 'output': ['2']}, {'input': '53 80 20 40\\r\\n70 80 2 3\\r\\n', 'output': ['4']}, {'input': '73 -41 20 40\\r\\n91 -35 1 49\\r\\n', 'output': ['1']}, {'input': '-8 -34 20 40\\r\\n9 -34 2 57\\r\\n', 'output': ['2']}, {'input': '51 -40 20 40\\r\\n60 -40 9 31\\r\\n', 'output': ['2']}, {'input': '-29 87 20 40\\r\\n-11 93 1 94\\r\\n', 'output': ['2']}, {'input': '-64 3 20 40\\r\\n-55 7 6 30\\r\\n', 'output': ['2']}, {'input': '24 36 20 40\\r\\n41 39 1 2\\r\\n', 'output': ['4']}, {'input': '-56 -64 20 40\\r\\n44 2 96 100\\r\\n', 'output': ['0']}, {'input': '-59 -17 20 40\\r\\n21 -17 59 100\\r\\n', 'output': ['0']}, {'input': '-43 -3 20 40\\r\\n57 -3 79 80\\r\\n', 'output': ['1']}, {'input': '20 57 20 40\\r\\n99 69 58 100\\r\\n', 'output': ['0']}, {'input': '36 82 20 40\\r\\n96 82 38 100\\r\\n', 'output': ['1']}, {'input': '-55 37 20 40\\r\\n4 47 38 100\\r\\n', 'output': ['1']}, {'input': '-58 -4 20 40\\r\\n42 91 99 100\\r\\n', 'output': ['1']}, {'input': '28 51 20 40\\r\\n67 51 1 58\\r\\n', 'output': ['0']}, {'input': '-79 -62 20 40\\r\\n-41 -62 2 58\\r\\n', 'output': ['0']}, {'input': '-19 -10 20 40\\r\\n20 -10 1 19\\r\\n', 'output': ['1']}, {'input': '-95 -64 20 40\\r\\n-56 -64 1 78\\r\\n', 'output': ['0']}, {'input': '-17 -7 20 40\\r\\n22 -7 1 79\\r\\n', 'output': ['1']}, {'input': '-45 86 20 40\\r\\n-6 86 1 99\\r\\n', 'output': ['1']}, {'input': '-71 -23 20 40\\r\\n-32 -23 1 18\\r\\n', 'output': ['1']}, {'input': '-20 11 20 40\\r\\n80 11 60 100\\r\\n', 'output': ['1']}, {'input': '-27 97 20 40\\r\\n51 97 38 98\\r\\n', 'output': ['1']}, {'input': '-47 -84 20 40\\r\\n52 -64 61 81\\r\\n', 'output': ['2']}, {'input': '-81 99 20 40\\r\\n-3 99 38 99\\r\\n', 'output': ['1']}, {'input': '-54 25 20 40\\r\\n6 25 20 100\\r\\n', 'output': ['2']}, {'input': '-22 40 20 40\\r\\n36 40 18 100\\r\\n', 'output': ['2']}, {'input': '-71 15 20 40\\r\\n29 90 85 100\\r\\n', 'output': ['2']}, {'input': '31 -13 20 40\\r\\n69 -5 1 56\\r\\n', 'output': ['0']}, {'input': '-46 55 20 40\\r\\n-17 55 7 11\\r\\n', 'output': ['1']}, {'input': '-35 25 20 40\\r\\n-6 32 7 10\\r\\n', 'output': ['1']}, {'input': '27 -98 20 40\\r\\n65 -98 1 58\\r\\n', 'output': ['0']}, {'input': '-100 -19 20 40\\r\\n-62 -19 1 18\\r\\n', 'output': ['1']}, {'input': '48 66 20 40\\r\\n78 66 9 10\\r\\n', 'output': ['2']}, {'input': '-37 -22 20 40\\r\\n-8 -22 8 9\\r\\n', 'output': ['2']}, {'input': '-42 41 20 40\\r\\n-4 49 1 78\\r\\n', 'output': ['0']}, {'input': '-2 -27 20 40\\r\\n35 -27 1 77\\r\\n', 'output': ['1']}, {'input': '-28 -36 20 40\\r\\n10 -28 1 100\\r\\n', 'output': ['1']}, {'input': '-17 31 20 40\\r\\n21 39 1 14\\r\\n', 'output': ['1']}, {'input': '1 44 20 40\\r\\n39 44 1 2\\r\\n', 'output': ['2']}, {'input': '21 -99 20 40\\r\\n58 -97 1 2\\r\\n', 'output': ['2']}, {'input': '-86 -97 20 40\\r\\n14 -31 79 100\\r\\n', 'output': ['1']}, {'input': '-33 42 20 40\\r\\n47 42 39 100\\r\\n', 'output': ['1']}, {'input': '-79 45 20 40\\r\\n21 45 57 80\\r\\n', 'output': ['2']}, {'input': '-99 -66 20 40\\r\\n-20 -54 39 100\\r\\n', 'output': ['1']}, {'input': '39 -44 20 40\\r\\n99 -44 17 100\\r\\n', 'output': ['2']}, {'input': '10 86 20 40\\r\\n69 96 19 100\\r\\n', 'output': ['2']}, {'input': '-72 -4 20 40\\r\\n28 93 99 100\\r\\n', 'output': ['2']}, {'input': '-81 -55 20 40\\r\\n19 20 83 85\\r\\n', 'output': ['4']}, {'input': '-65 -34 20 40\\r\\n35 66 99 100\\r\\n', 'output': ['4']}, {'input': '-91 -46 10 50\\r\\n-73 -40 30 31\\r\\n', 'output': ['2']}]","id":49} {"description":"Consider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the element of the matrix which is located at the intersection of the i-row and the j-th column as Ai,\u2009j.Let's call matrix A clear if no two cells containing ones have a common side.Let's call matrix A symmetrical if it matches the matrices formed from it by a horizontal and\/or a vertical reflection. Formally, for each pair (i,\u2009j) (1\u2009\u2264\u2009i,\u2009j\u2009\u2264\u2009n) both of the following conditions must be met: Ai,\u2009j\u2009=\u2009An\u2009-\u2009i\u2009+\u20091,\u2009j and Ai,\u2009j\u2009=\u2009Ai,\u2009n\u2009-\u2009j\u2009+\u20091.Let's define the sharpness of matrix A as the number of ones in it.Given integer x, your task is to find the smallest positive integer n such that there exists a clear symmetrical matrix A with side n and sharpness x.","input_specification":"The only line contains a single integer x (1\u2009\u2264\u2009x\u2009\u2264\u2009100) \u2014 the required sharpness of the matrix.","output_specification":"Print a single number \u2014 the sought value of n.","notes":"NoteThe figure below shows the matrices that correspond to the samples: ","sample_inputs":["4","9"],"sample_outputs":["3","5"],"src_uid":"01eccb722b09a0474903b7e5abc4c47a","lang_cluster":"C++","difficulty":1700,"human_solution":"\/*\r\n Jai shankar\r\n\r\n _.Y-'''''`..\r\n ,' `.\r\n \/ `\\\r\n |' `\\\r\n | .,-------.. '|\r\n | `.......--' \\'\r\n | \/--+--+--\\ '\r\n | \"..|\\,:-'' |\r\n ____| ,-''''''''b |----.._\r\n .,--i,.--| '\"------'' |''''--:`----..._\r\n'|,--' | | `.--::--.:;_\r\n|| ,YY'''''`- .`.\r\n| `-...__ ,-' '` \\|\r\n \\,_`--..:::--....____ ___...-'' ,-''-b ||\r\n ':--.... ,,.,--'' ``.. ||\r\n `-. ``-------....,--'',\/ `|\r\n \\. \/|\r\n || \\|\r\n || `b\r\n ,b' ``=\r\n ,-''' '``.\r\n | |\r\n | :dg: |\r\n `---'''''`-------------'''''''''''\r\n\r\n *\/\r\n\r\n#include \r\n#include \r\nusing namespace std;\r\n#include \r\n#include \r\n\r\n#define ll long long\r\n#define pii pair\r\n#define pll pair\r\n#define vi vector\r\n#define vll vector\r\n#define mii map\r\n#define si set\r\n#define ff first\r\n#define ss second\r\n\/\/ #define sc set\r\n\r\n\/* FUNCTION *\/\r\n#define f(i, s, e) for (long long i = s; i < e; i++)\r\n#define fe(i, s, e) for (long long i = s; i <= e; i++)\r\n#define rf(i, e, s) for (long long i = e - 1; i >= s; i--)\r\n#define pb push_back\r\n#define eb emplace_back\r\n\r\n\/* PRINTS *\/\r\ntemplate \r\nvoid print_v(vector &v)\r\n{\r\n cout << \"{\";\r\n for (auto x : v)\r\n cout << x << \",\";\r\n cout << \"\\b\";\r\n}\r\n\r\n\/* UTILS *\/\r\n#define MOD 1000000007\r\n#define debug(x) cout << #x << \" \" << x << endl;\r\n#define pi 3.14159\r\nll min(ll a, int b)\r\n{\r\n if (a < b)\r\n return a;\r\n return b;\r\n}\r\nll min(int a, ll b)\r\n{\r\n if (a < b)\r\n return a;\r\n return b;\r\n}\r\nll max(ll a, int b)\r\n{\r\n if (a > b)\r\n return a;\r\n return b;\r\n}\r\nll max(int a, ll b)\r\n{\r\n if (a > b)\r\n return a;\r\n return b;\r\n}\r\nll gcd(ll a, ll b)\r\n{\r\n if (b == 0)\r\n return a;\r\n return gcd(b, a % b);\r\n}\r\nll lcm(ll a, ll b) { return a \/ gcd(a, b) * b; }\r\nstring to_upper(string a)\r\n{\r\n for (int i = 0; i < (int)a.size(); ++i)\r\n if (a[i] >= 'a' && a[i] <= 'z')\r\n a[i] -= 'a' - 'A';\r\n return a;\r\n}\r\nstring to_lower(string a)\r\n{\r\n for (int i = 0; i < (int)a.size(); ++i)\r\n if (a[i] >= 'A' && a[i] <= 'Z')\r\n a[i] += 'a' - 'A';\r\n return a;\r\n}\r\nbool prime(ll a)\r\n{\r\n if (a == 1)\r\n return 0;\r\n for (int i = 2; i <= round(sqrt(a)); ++i)\r\n if (a % i == 0)\r\n return 0;\r\n return 1;\r\n}\r\n\r\nll pow(ll a,ll b){\r\n a %= MOD;\r\n long long res = 1;\r\n while (b > 0) {\r\n if (b & 1)\r\n res = res * a % MOD;\r\n a = a * a % MOD;\r\n b >>= 1;\r\n }\r\n return res;\r\n}\r\n\r\nvoid yes() { cout << \"YES\\n\"; }\r\nvoid no() { cout << \"NO\\n\"; }\r\n\r\ntypedef long int int32;\r\ntypedef unsigned long int uint32;\r\ntypedef long long int int64;\r\ntypedef unsigned long long int uint64;\r\ntypedef vector vl;\r\ntypedef vector vc;\r\ntypedef vector vs;\r\n\r\ntemplate \r\nvoid add(T &a, T b, T M)\r\n{\r\n a = ((a % M) + (b % M)) % M;\r\n}\r\n\r\ntemplate \r\nvoid mul(T &a, T b, T M)\r\n{\r\n a = ((a % M) * (b % M)) % M;\r\n}\r\n\r\ntemplate \r\nvoid sub(T &a, T b, T M)\r\n{\r\n a = (a - b + M) % M;\r\n}\r\ntypedef vector>vpl; \r\n#define all(v) (v).begin(),(v).end() \r\n\r\n\r\nclass dsu{\r\n ll n;\r\n vector par, sz;\r\npublic:\r\n dsu(int s){\r\n n=s;\r\n for(int i=0; i &dist,vector &parent vector> *adj) {\r\n\/\/ dist.assign(n, 1e18);\r\n\/\/ parent.assign(n, -1);\r\n\/\/ dist[s] = 0;\r\n\/\/ priority_queue , vector>, greater>> q;\r\n\/\/ q.push({0, s});\r\n\/\/ while (!q.empty()) {\r\n\/\/ pair here = q.top();\r\n\/\/ q.pop();\r\n\/\/ ll v = here.ss;\r\n\/\/ ll d_v = here.ff;\r\n\/\/ if (d_v != dist[v])\r\n\/\/ continue;\r\n\/\/ for (auto edge : adj[v]) {\r\n\/\/ if (dist[v] + edge.ss < dist[edge.ff]) {\r\n\/\/ dist[edge.ff] = dist[v] + edge.ss;\r\n\/\/ maxi=max(maxi, edge.ss);\r\n\/\/ parent[edge.ff] = v;\r\n\/\/ q.push({dist[edge.ff], edge.ff});\r\n\/\/ }\r\n\/\/ }\r\n\/\/ }\r\n\/\/ }\r\n\r\n\/* ------------------------------------------ OM GAN GANPATYAY NAMAH -------------------------------------------------*\/\r\nvoid dijkstra(ll src, vector *adj, vector & dis){\r\n set > st;\r\n\r\n st.insert({0, src});\r\n while(!st.empty()){\r\n auto it=*st.begin();\r\n st.erase(st.begin());\r\n ll node=it.ss;\r\n ll d= it.ff;\r\n\r\n for(int it:adj[node]){\r\n if(d+1=n || j<0 || j>=m) return 0;\r\n return 1;\r\n}\r\n\r\nint main(){\r\n\r\n #ifndef ONLINE_JUDGE\r\n freopen(\"input.txt\", \"r\", stdin); \/\/ file input.txt is opened in reading mode i.e \"r\"\r\n freopen(\"output.txt\", \"w\", stdout); \/\/ file output.txt is opened in writing mode i.e \"w\"\r\n #endif\r\n \/\/ ncr();\r\n ios_base::sync_with_stdio(false);\r\n cin.tie(NULL);\r\n cout.tie(NULL);\r\n \/\/ const int M = 998244353;\r\n \/\/ ll t;\r\n \/\/ cin >> t;\r\n \/\/ while (t--) {\r\n\r\n\/\/ \/*======================= KYA RE BHIKH-MANGEYA AA GYA CODE PADHNE =======================*\/\r\n \/\/ int n,k;\r\n\r\n int n;\r\n cin>>n;\r\n int sum=0;\r\n int i=1;\r\n while((i*i+1)\/2\r\nusing namespace std;\r\n \r\nconst int MOD = 1000000007;\r\n \r\nint N;\r\n \r\nint main(){\r\n cin >> N;\r\n int red = 0, blue = 0;\r\n for (int i = 0; i < N; i++){\r\n if (i % 2 == 0){\r\n red += blue + 1;\r\n red %= MOD;\r\n }\r\n else{\r\n blue += red + 1;\r\n blue %= MOD;\r\n }\r\n }\r\n cout << (red + blue) % MOD << endl;\r\n return 0;\r\n}","testcases":"[{'input': '3\\r\\n', 'output': ['6']}, {'input': '4\\r\\n', 'output': ['11']}, {'input': '1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n', 'output': ['3']}, {'input': '5\\r\\n', 'output': ['19']}, {'input': '6\\r\\n', 'output': ['32']}, {'input': '7\\r\\n', 'output': ['53']}, {'input': '8\\r\\n', 'output': ['87']}, {'input': '9\\r\\n', 'output': ['142']}, {'input': '10\\r\\n', 'output': ['231']}, {'input': '11\\r\\n', 'output': ['375']}, {'input': '12\\r\\n', 'output': ['608']}, {'input': '13\\r\\n', 'output': ['985']}, {'input': '14\\r\\n', 'output': ['1595']}, {'input': '15\\r\\n', 'output': ['2582']}, {'input': '16\\r\\n', 'output': ['4179']}, {'input': '17\\r\\n', 'output': ['6763']}, {'input': '18\\r\\n', 'output': ['10944']}, {'input': '19\\r\\n', 'output': ['17709']}, {'input': '20\\r\\n', 'output': ['28655']}, {'input': '21\\r\\n', 'output': ['46366']}, {'input': '22\\r\\n', 'output': ['75023']}, {'input': '30\\r\\n', 'output': ['3524576']}, {'input': '40\\r\\n', 'output': ['433494435']}, {'input': '35\\r\\n', 'output': ['39088167']}, {'input': '747\\r\\n', 'output': ['864986803']}, {'input': '811\\r\\n', 'output': ['121575679']}, {'input': '523\\r\\n', 'output': ['810594171']}, {'input': '939\\r\\n', 'output': ['834252191']}, {'input': '7218\\r\\n', 'output': ['124017976']}, {'input': '6578\\r\\n', 'output': ['105202924']}, {'input': '4994\\r\\n', 'output': ['909729063']}, {'input': '3410\\r\\n', 'output': ['995527079']}, {'input': '9122\\r\\n', 'output': ['424682518']}, {'input': '11500\\r\\n', 'output': ['123418864']}, {'input': '37212\\r\\n', 'output': ['991850249']}, {'input': '95628\\r\\n', 'output': ['265542306']}, {'input': '21341\\r\\n', 'output': ['913329411']}, {'input': '63405\\r\\n', 'output': ['206564501']}, {'input': '670293\\r\\n', 'output': ['922731630']}, {'input': '12357\\r\\n', 'output': ['808648710']}, {'input': '838069\\r\\n', 'output': ['536545985']}, {'input': '696485\\r\\n', 'output': ['467961960']}, {'input': '1000000\\r\\n', 'output': ['986892583']}, {'input': '999999\\r\\n', 'output': ['452491920']}, {'input': '999998\\r\\n', 'output': ['534400661']}, {'input': '999997\\r\\n', 'output': ['918091264']}, {'input': '999996\\r\\n', 'output': ['616309402']}, {'input': '999000\\r\\n', 'output': ['47031574']}, {'input': '100\\r\\n', 'output': ['252403354']}]","id":51} {"description":"A bracket sequence is a string, containing only characters \"(\", \")\", \"[\" and \"]\".A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters \"1\" and \"+\" between the original characters of the sequence. For example, bracket sequences \"()[]\", \"([])\" are correct (the resulting expressions are: \"(1)+[1]\", \"([1+1]+1)\"), and \"](\" and \"[\" are not. The empty string is a correct bracket sequence by definition.A substring s[l... r] (1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009|s|) of string s\u2009=\u2009s1s2... s|s| (where |s| is the length of string s) is the string slsl\u2009+\u20091... sr. The empty string is a substring of any string by definition.You are given a bracket sequence, not necessarily correct. Find its substring which is a correct bracket sequence and contains as many opening square brackets \u00ab[\u00bb as possible.","input_specification":"The first and the only line contains the bracket sequence as a string, consisting only of characters \"(\", \")\", \"[\" and \"]\". It is guaranteed that the string is non-empty and its length doesn't exceed 105 characters.","output_specification":"In the first line print a single integer \u2014 the number of brackets \u00ab[\u00bb in the required bracket sequence. In the second line print the optimal sequence. If there are more than one optimal solutions print any of them.","notes":null,"sample_inputs":["([])","((("],"sample_outputs":["1\n([])","0"],"src_uid":"5ce8de80c6953cd1e6e6eefd9ad35f7e","lang_cluster":"C++","difficulty":1700,"human_solution":"#include\n#include\n#include\n\nusing namespace std;\n\nvoid __print(int x) {cerr << x;}\nvoid __print(long x) {cerr << x;}\nvoid __print(long long x) {cerr << x;}\nvoid __print(unsigned x) {cerr << x;}\nvoid __print(unsigned long x) {cerr << x;}\nvoid __print(unsigned long long x) {cerr << x;}\nvoid __print(float x) {cerr << x;}\nvoid __print(double x) {cerr << x;}\nvoid __print(long double x) {cerr << x;}\nvoid __print(char x) {cerr << '\\'' << x << '\\'';}\nvoid __print(const char *x) {cerr << '\\\"' << x << '\\\"';}\nvoid __print(const string &x) {cerr << '\\\"' << x << '\\\"';}\nvoid __print(bool x) {cerr << (x ? \"true\" : \"false\");}\n\ntemplate\nvoid __print(const pair &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}\ntemplate\nvoid __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? \",\" : \"\"), __print(i); cerr << \"}\";}\nvoid _print() {cerr << \"]\\n\";}\ntemplate \nvoid _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << \", \"; _print(v...);}\n#ifndef ONLINE_JUDGE\n#define debug(x...) cerr << \"[\" << #x << \"] = [\"; _print(x)\n#else\n#define debug(x...)\n#endif\n\n#define INF 1e9+7\n#define all(x) x.begin(),x.end()\n#define endl '\\n'\ntypedef long long ll;\nusing pii=pair;\n\nusing namespace __gnu_pbds;\ntemplate \nusing ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>;\n\nstring text;\nint cnt[100010];\nint n;\nint ans;\nint ansL,ansR;\n\nint solve(int l,int r) {\n if(!l) return cnt[r];\n return cnt[r]-cnt[l-1];\n}\nvector seg;\n\nint main () {\n ios::sync_with_stdio(false); cin.tie(0);\n cin>>text; n=text.size();\n for(int i=0;i s;\n for(int i=0;ians) {\n ansL=l; ansR=r; ans=res;\n }\n l=seg[i].first; r=seg[i].second;\n }\n }\n\n int res=solve(l,r);\n if(res>ans) {\n ansL=l; ansR=r; ans=res;\n }\n \/\/debug(seg);\n cout<\n#include \n#include \n#include \n\ndouble comb[1001][1001];\ndouble dp[1001][1001];\nint obj[1001][1001];\nbool flag[1001];\nint cnt[1001], cnt2[1001];\nint price[1001];\nint n, m, s, k, p, q;\nint main(){\n\tint i, j;\n\n\tcomb[0][0] = 1.;\n\tfor(i = 1; i <= 1000; i ++){\n\t\tcomb[i][0] = 1.;\n\t\tfor(j = 1; j < i; j ++){\n\t\t\tcomb[i][j] = comb[i-1][j] + comb[i-1][j-1];\n\t\t}\n\t\tcomb[i][i] = 1.;\n\t}\n\n\tscanf(\"%d%d\", &m, &n);\n\ts = 0;\n\tfor(i = 0; i < n; i ++){\n\t\tscanf(\"%d\", cnt + i);\n\t\tfor(j = 0; j < cnt[i]; j ++){\n\t\t\tscanf(\"%d\", &obj[i][j]);\n\t\t\tprice[s] = obj[i][j];\n\t\t\t++ s;\n\t\t}\n\t}\n\n\tstd::sort(price, price + s);\n\tk = price[s - m];\n\tp = 0;\n\tfor(i = 0; i < n; i ++){\n\t\tflag[i] = false;\n\t\tcnt2[i] = 0;\n\t\tfor(j = 0; j < cnt[i]; j ++){\n\t\t\tif(obj[i][j] == k){\n\t\t\t\tflag[i] = true;\n\t\t\t\tp ++;\n\t\t\t}\n\t\t\tif(obj[i][j] > k){\n\t\t\t\tcnt2[i] ++;\n\t\t\t}\n\t\t}\n\t}\n\tq = 0;\n\tfor(i = s - m; i < s && price[i] == k; i ++){\n\t\tq ++;\n\t}\n\n\tdp[0][0] = 1.;\n\tfor(i = 1; i <= n; i ++){\n\t\tfor(j = 0; j <= s; j ++){\n\t\t\tdp[i][j] = dp[i-1][j] \/ comb[cnt[i-1]][cnt2[i-1]];\n\t\t\tif(flag[i - 1] && j > 0){\n\t\t\t\tdp[i][j] += dp[i-1][j-1] \/ comb[cnt[i-1]][cnt2[i-1] + 1];\n\t\t\t}\n\t\t}\n\t}\n\n\tprintf(\"%.9lf\\n\", dp[n][q] \/ comb[p][q]);\n\n\treturn 0;\n}\n","testcases":"[{'input': '3 1\\r\\n3 10 20 30\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '3 2\\r\\n1 40\\r\\n4 10 20 30 40\\r\\n', 'output': ['0.166666667\\r\\n']}, {'input': '5 1\\r\\n5 1 2 3 4 5\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '6 2\\r\\n3 1 2 3\\r\\n3 4 5 6\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '6 2\\r\\n3 1 2 3\\r\\n3 1 2 3\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '6 2\\r\\n3 2 3 1\\r\\n3 5 4 6\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '6 2\\r\\n3 999999998 999999999 1000000000\\r\\n3 999999998 999999999 1000000000\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '2 2\\r\\n2 1 2\\r\\n2 1 2\\r\\n', 'output': ['0.250000000\\r\\n']}, {'input': '4 6\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '8 6\\r\\n5 5 4 3 2 1\\r\\n5 5 4 3 2 1\\r\\n3 5 3 1\\r\\n2 3 1\\r\\n1 3\\r\\n1 3\\r\\n', 'output': ['0.002500000\\r\\n']}, {'input': '5 10\\r\\n1 10\\r\\n1 9\\r\\n1 8\\r\\n1 7\\r\\n1 6\\r\\n1 5\\r\\n1 4\\r\\n1 3\\r\\n1 2\\r\\n1 1\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '2 1\\r\\n2 1 2\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '3 1\\r\\n3 1 2 3\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '2 3\\r\\n2 2 4\\r\\n1 2\\r\\n1 1\\r\\n', 'output': ['0.750000000\\r\\n']}, {'input': '3 2\\r\\n3 2 3 5\\r\\n2 1 3\\r\\n', 'output': ['0.166666667\\r\\n']}, {'input': '2 2\\r\\n4 1 3 5 6\\r\\n2 1 2\\r\\n', 'output': ['0.166666667\\r\\n']}, {'input': '7 2\\r\\n5 1 2 3 4 6\\r\\n2 1 2\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '3 3\\r\\n5 1 3 4 5 6\\r\\n2 2 4\\r\\n1 1\\r\\n', 'output': ['0.075000000\\r\\n']}, {'input': '8 3\\r\\n4 2 3 5 7\\r\\n4 1 3 5 6\\r\\n1 1\\r\\n', 'output': ['0.625000000\\r\\n']}, {'input': '9 5\\r\\n2 1 3\\r\\n4 2 4 6 7\\r\\n1 2\\r\\n2 2 3\\r\\n1 2\\r\\n', 'output': ['0.500000000\\r\\n']}, {'input': '1 5\\r\\n3 2 3 4\\r\\n3 1 2 3\\r\\n3 2 4 5\\r\\n1 1\\r\\n1 1\\r\\n', 'output': ['0.333333333\\r\\n']}, {'input': '11 4\\r\\n3 2 4 6\\r\\n6 1 3 5 7 9 10\\r\\n2 1 2\\r\\n1 1\\r\\n', 'output': ['0.555555556\\r\\n']}, {'input': '10 4\\r\\n2 2 3\\r\\n6 1 3 5 7 8 10\\r\\n4 1 2 4 5\\r\\n1 1\\r\\n', 'output': ['0.041666667\\r\\n']}, {'input': '11 6\\r\\n1 1\\r\\n4 1 2 3 4\\r\\n2 1 2\\r\\n3 2 3 4\\r\\n2 1 2\\r\\n2 1 2\\r\\n', 'output': ['0.143750000\\r\\n']}, {'input': '7 5\\r\\n1 1\\r\\n5 2 4 6 8 10\\r\\n6 1 3 4 5 7 8\\r\\n2 1 3\\r\\n1 2\\r\\n', 'output': ['0.008333333\\r\\n']}, {'input': '1 5\\r\\n6 1 3 5 7 8 10\\r\\n5 1 2 4 6 7\\r\\n1 1\\r\\n3 1 2 3\\r\\n1 1\\r\\n', 'output': ['0.166666667\\r\\n']}, {'input': '9 5\\r\\n1 2\\r\\n6 1 2 3 5 7 9\\r\\n4 2 3 5 6\\r\\n1 2\\r\\n6 2 4 6 8 9 11\\r\\n', 'output': ['0.000555556\\r\\n']}, {'input': '20 9\\r\\n4 2 3 4 6\\r\\n4 2 4 5 6\\r\\n1 2\\r\\n3 2 4 6\\r\\n2 2 3\\r\\n2 2 3\\r\\n1 2\\r\\n2 2 4\\r\\n1 1\\r\\n', 'output': ['1.000000000\\r\\n']}, {'input': '21 12\\r\\n7 657 7 6 5 4 2 1\\r\\n8 142 9 7 6 5 4 2 1\\r\\n8 853 9 8 7 6 4 2 1\\r\\n11 708 369 9 8 7 6 5 4 3 2 1\\r\\n8 9 8 7 6 5 4 3 2\\r\\n9 969 867 774 9 8 7 5 4 2\\r\\n9 869 575 527 9 7 5 4 3 2\\r\\n8 839 248 77 9 7 6 3 1\\r\\n9 952 9 7 6 5 4 3 2 1\\r\\n7 380 9 8 7 6 5 4\\r\\n9 511 494 203 9 8 7 6 4 1\\r\\n7 721 8 7 6 5 4 2\\r\\n', 'output': ['0.000000000\\r\\n']}, {'input': '51 9\\r\\n7 483 459 7 6 5 2 1\\r\\n12 953 940 926 792 612 241 7 5 4 3 2 1\\r\\n14 904 633 441 361 324 286 79 8 7 6 5 4 2 1\\r\\n12 928 450 443 426 53 9 8 7 6 5 4 1\\r\\n10 643 415 202 109 106 9 7 6 4 1\\r\\n10 803 582 381 354 216 169 6 5 3 1\\r\\n12 813 701 569 467 328 179 63 8 7 5 3 1\\r\\n12 822 636 573 563 480 370 367 8 7 6 5 1\\r\\n11 910 774 463 175 80 8 7 5 4 2 1\\r\\n', 'output': ['0.000000000\\r\\n']}, {'input': '90 50\\r\\n3 523 254 10\\r\\n2 335 10\\r\\n1 10\\r\\n3 645 293 10\\r\\n3 174 56 10\\r\\n1 10\\r\\n1 10\\r\\n1 10\\r\\n1 10\\r\\n3 384 161 10\\r\\n2 465 10\\r\\n2 582 10\\r\\n1 10\\r\\n1 10\\r\\n2 165 10\\r\\n2 673 10\\r\\n2 638 10\\r\\n4 653 535 192 10\\r\\n2 269 10\\r\\n3 427 134 10\\r\\n2 966 10\\r\\n1 10\\r\\n3 221 21 10\\r\\n2 840 10\\r\\n2 764 10\\r\\n1 10\\r\\n2 747 10\\r\\n2 67 10\\r\\n1 10\\r\\n3 951 13 10\\r\\n3 651 405 10\\r\\n1 10\\r\\n1 10\\r\\n3 729 87 10\\r\\n2 631 10\\r\\n2 376 10\\r\\n2 652 10\\r\\n1 10\\r\\n1 10\\r\\n3 923 233 10\\r\\n2 450 10\\r\\n2 830 10\\r\\n2 271 10\\r\\n3 775 391 10\\r\\n3 850 733 10\\r\\n2 598 10\\r\\n1 10\\r\\n3 797 682 10\\r\\n3 596 508 10\\r\\n1 10\\r\\n', 'output': ['0.005722876\\r\\n']}]","id":53} {"description":"Not long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1,\u2009N], and it was asked to check whether the equation AB\u2009=\u2009C is correct. Recently Billy studied the concept of a digital root of a number. We should remind you that a digital root d(x) of the number x is the sum s(x) of all the digits of this number, if s(x)\u2009\u2264\u20099, otherwise it is d(s(x)). For example, a digital root of the number 6543 is calculated as follows: d(6543)\u2009=\u2009d(6\u2009+\u20095\u2009+\u20094\u2009+\u20093)\u2009=\u2009d(18)\u2009=\u20099. Billy has counted that the digital root of a product of numbers is equal to the digital root of the product of the factors' digital roots, i.e. d(xy)\u2009=\u2009d(d(x)d(y)). And the following solution to the problem came to his mind: to calculate the digital roots and check if this condition is met. However, Billy has doubts that this condition is sufficient. That's why he asks you to find out the amount of test examples for the given problem such that the algorithm proposed by Billy makes mistakes.","input_specification":"The first line contains the only number N (1\u2009\u2264\u2009N\u2009\u2264\u2009106).","output_specification":"Output one number \u2014 the amount of required A, B and C from the range [1,\u2009N].","notes":"NoteFor the first sample the required triples are (3,\u20094,\u20093) and (4,\u20093,\u20093).","sample_inputs":["4","5"],"sample_outputs":["2","6"],"src_uid":"fc133fe6353089a0ebee08dec919f608","lang_cluster":"C++","difficulty":2000,"human_solution":"#include \r\n#include \r\n#include \r\nusing namespace std;\r\nconst int maxn=1000010;\r\nlong long c[10];\r\nint f[maxn];\r\nint prime[maxn];\r\nint vis[maxn];\r\nint d(int x)\r\n{\r\n\tint tmp=0;\r\n\twhile(x)\r\n\t{\r\n\t\ttmp+=x%10;\r\n\t\tx\/=10;\r\n\t}\r\n\treturn tmp<10?tmp:d(tmp);\r\n}\r\nvoid init()\r\n{\r\n\tmemset(vis,0,sizeof(vis));\r\n\tf[1]=1;\r\n\tint tot=0;\r\n\tfor(int i=2;i<=1000000;i++)\r\n\t{\r\n\t\tif(!vis[i])\r\n\t\t{\r\n\t\t\tf[i]=2;\r\n\t\t\tprime[tot++]=i;\r\n\t\t}\r\n\t\tfor(int j=0;j1000000) break;\r\n\t\t\tvis[i*prime[j]]=1;\r\n\t\t\tif(i%prime[j]==0) \r\n\t\t\t{\r\n\t\t\t\tint tmp=i;\r\n\t\t\t\twhile(tmp%prime[j]==0) tmp\/=prime[j];\r\n\t\t\t\tf[i*prime[j]]=(f[i\/tmp]+1)*f[tmp];\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\telse f[i*prime[j]]=f[i]*f[prime[j]];\r\n\t\t}\r\n\t}\r\n}\r\nint main()\r\n{\r\n\tinit();\r\n\tint n;\r\n\tscanf(\"%d\",&n);\r\n\tlong long res=0;\r\n\tfor(int i=1;i<=n;i++)\r\n\t{\r\n\t\tc[d(i)]++;\r\n\t\tres+=f[i];\r\n\t\/\/\tcout<\n#define LL long long\nusing namespace std;\nvectorve;\nLL M;\nvoid qfind(int n)\n{\n\tfor (int i = 2; i*i <= n; ++i)\n\t\tif (n%i == 0)\n\t\t{\n\t\t\tn \/= i; ve.push_back(i);\n\t\t\twhile (n%i == 0) n \/= i;\n\t\t\tqfind(n);\n\t\t\treturn;\n\t\t}\n\tif(ve.size()==0||n>*ve.rbegin())ve.push_back(n);\n}\nLL power(LL x, LL n)\n{\n\tLL ans = 1;\n\twhile (n)\n\t{\n\t\tif (n & 1)ans = ans*x%M;\n\t\tx = x*x%M;\n\t\tn >>= 1;\n\t}\n\treturn ans;\n}\nint main()\n{\n\tstring b, n; LL c;\n\tcin >> b >> n;\n\tscanf(\"%lld\", &c);\n\tLL nn = 0, bb = 0;\n\tM = c;\n\tfor (int i = 0; i< b.length(); ++i)\n\t\tbb = (bb * 10 % c + b[i] - '0') % M;\n\tif (n.length() <= 11)\n\t{\n\t\tfor (int i = 0; i\r\n#include \r\n#include \r\nusing namespace std;\r\nusing namespace __gnu_pbds;\r\n#define PI acos(-1)\r\n#define LSB(i) ((i) & -(i))\r\n#define ll long long\r\n#define pb push_back\r\n#define mp make_pair\r\n#define mt make_tuple\r\n#define fi first\r\n#define sc second\r\n#define th third\r\n#define fo fourth\r\n#define pii pair\r\n#define pll pair\r\n#define ldb double\r\n#define INF 1e15\r\n#define MOD 1000000007\r\n#define endl \"\\n\"\r\n\r\n#define all(data) data.begin(),data.end()\r\n#define TYPEMAX(type) std::numeric_limits::max()\r\n#define TYPEMIN(type) std::numeric_limits::min()\r\n#define MAXN 20\r\nll a[2*MAXN];\r\nll dp[MAXN][MAXN],pow10[MAXN];\r\nint main()\r\n{\r\n ios::sync_with_stdio(false); cin.tie(0);\r\n pow10[0]=1;\r\n for(int i=1;i<18;i++) pow10[i]=10*pow10[i-1];\r\n ll n; cin>>n; char c;\r\n for(int i=1;i<=2*n;i++) {cin>>c; a[i]=c-'0';}\r\n for(int i=1;i<=n;i++) swap(a[i],a[2*n-i+1]);\r\n for(int i=0;i<=n;i++)\r\n {\r\n for(int j=0;j<=n;j++)\r\n {\r\n dp[i][j]=0;\r\n if(i) dp[i][j]=max(dp[i][j],dp[i-1][j]+pow10[i-1]*a[i+j]);\r\n if(j) dp[i][j]=max(dp[i][j],dp[i][j-1]+pow10[j-1]*a[i+j]);\r\n }\r\n }\r\n vector v;\r\n ll i=n,j=n;\r\n while(i || j)\r\n {\r\n if(i && j)\r\n {\r\n if(dp[i][j]==dp[i-1][j]+pow10[i-1]*a[i+j]) {v.pb('H'); i--;}\r\n else {v.pb('M'); j--;}\r\n }\r\n else if(i) {v.pb('H'); i--;}\r\n else {v.pb('M'); j--;}\r\n }\r\n \/\/reverse(all(v));\r\n for(auto x:v) cout< \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n \nusing namespace std; \n \n#pragma comment(linker, \"\/STACK:64000000\") \n \n#define problem \"Khaustov\" \n\ntypedef long long int64; \ntypedef unsigned char byte; \ntypedef pair pii;\ntypedef pair piii;\ntypedef pair pii64;\ntypedef pair piii64;\ntypedef pair pdi;\ntypedef pair pdd;\ntypedef pair pdii;\ntypedef pair pis;\ntypedef vector vi; \ntypedef vector vvi;\ntypedef vector vvvi;\ntypedef vector vpii; \ntypedef vector vvpii; \ntypedef vector vs; \ntypedef vector vvs; \ntypedef list li; \ntypedef stringstream ss; \n \n#define y1 _dsfdsfkn\n#define left _dsfdsf\n#define right _dfjdsj\n#define link _tsu_sux\n#define prime 1103\n#define eps 1e-8\n#define inf 123456789\n#define toMod 1000000007LL\n\ninline double sqr(double x)\n{\n return x * x;\n}\n\nint n, m;\npii PREV, CUR;\n\nint64 res;\nint k;\npii a[15000000];\n\ninline pii make(int x, int y)\n{\n if (x > y) swap(x, y);\n return pii(x, y);\n}\n\nint main() \n{ \n \/\/freopen(\"input.txt\", \"r\", stdin); freopen(\"output.txt\", \"w\", stdout);\n\n k = 0;\n scanf(\"%d%d\", &n, &m);\n res = 0;\n for (int b = 1; b <= n; ++b)\n {\n int MAX = b - 1;\n int MIN = 1;\n\n int64 sb = b;\n sb *= (int64)b;\n \n if (sb > m)\n {\n double T = sqrt((double)(sb - m));\n if (T > 1e-9) T -= 1e-9;\n MIN = (int)ceil(T);\n } else a[k++] = make(-b, -b);\n\n if (MIN > MAX)\n {\n int64 lim = min((int64)m, sb - 1);\n res += 2 * lim;\n continue;\n }\n\n int64 lim = min((int64)m, sb - 1);\n lim -= (MAX - MIN + 1);\n res += 2 * lim;\n\n a[k++] = make(MAX - b, MIN - b);\n a[k++] = make(-MAX - b, -MIN - b);\n }\n\n sort(a, a + k);\n if (k) res += (a[0].second - a[0].first + 1);\n for (int i = 1; i < k; ++i)\n {\n a[i].first = max(a[i].first, a[i - 1].second + 1);\n if (a[i].second >= a[i].first)\n res += (a[i].second - a[i].first + 1);\n a[i].second = max(a[i].second, a[i - 1].second);\n }\n\n printf(\"%lld\\n\", res);\n\n return 0; \n}","testcases":"[{'input': '3 3\\r\\n', 'output': ['12\\r\\n']}, {'input': '1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 2\\r\\n', 'output': ['5\\r\\n']}, {'input': '5 2\\r\\n', 'output': ['17\\r\\n']}, {'input': '2 1\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 3\\r\\n', 'output': ['6\\r\\n']}, {'input': '3 2\\r\\n', 'output': ['9\\r\\n']}, {'input': '1 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 1\\r\\n', 'output': ['5\\r\\n']}, {'input': '2 5000000\\r\\n', 'output': ['7\\r\\n']}, {'input': '4 4\\r\\n', 'output': ['23\\r\\n']}, {'input': '5 10\\r\\n', 'output': ['59\\r\\n']}, {'input': '10 5\\r\\n', 'output': ['86\\r\\n']}, {'input': '10 10\\r\\n', 'output': ['159\\r\\n']}, {'input': '6 36\\r\\n', 'output': ['151\\r\\n']}, {'input': '6 35\\r\\n', 'output': ['151\\r\\n']}, {'input': '6 37\\r\\n', 'output': ['151\\r\\n']}, {'input': '50 10\\r\\n', 'output': ['959\\r\\n']}, {'input': '100 17\\r\\n', 'output': ['3305\\r\\n']}, {'input': '56 46\\r\\n', 'output': ['4718\\r\\n']}, {'input': '15 5000000\\r\\n', 'output': ['2269\\r\\n']}, {'input': '5000000 5000000\\r\\n', 'output': ['49985062679840\\r\\n']}, {'input': '2000 4000000\\r\\n', 'output': ['5333335999\\r\\n']}, {'input': '2000 4000010\\r\\n', 'output': ['5333335999\\r\\n']}, {'input': '2000 3999993\\r\\n', 'output': ['5333335991\\r\\n']}, {'input': '5000000 16\\r\\n', 'output': ['159999914\\r\\n']}, {'input': '4991748 4783476\\r\\n', 'output': ['47741835370053\\r\\n']}, {'input': '4799983 5000\\r\\n', 'output': ['47999345584\\r\\n']}, {'input': '4000000 2000\\r\\n', 'output': ['15999876436\\r\\n']}, {'input': '4999993 1\\r\\n', 'output': ['9999985\\r\\n']}, {'input': '4999696 3\\r\\n', 'output': ['29998170\\r\\n']}, {'input': '1 4999696\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 4999697\\r\\n', 'output': ['89\\r\\n']}, {'input': '145675 98345\\r\\n', 'output': ['28611293247\\r\\n']}, {'input': '100 10000\\r\\n', 'output': ['666799\\r\\n']}, {'input': '3957602 4953270\\r\\n', 'output': ['39191413995652\\r\\n']}, {'input': '3829084 1534\\r\\n', 'output': ['11747546512\\r\\n']}, {'input': '8765 4937657\\r\\n', 'output': ['71920277547\\r\\n']}, {'input': '4888521 4888521\\r\\n', 'output': ['47780834303355\\r\\n']}, {'input': '4888522 4888521\\r\\n', 'output': ['47780844080397\\r\\n']}, {'input': '4888521 4888522\\r\\n', 'output': ['47780844075975\\r\\n']}, {'input': '4888520 4888521\\r\\n', 'output': ['47780824526313\\r\\n']}, {'input': '4888521 4888520\\r\\n', 'output': ['47780824530760\\r\\n']}, {'input': '2211 4888521\\r\\n', 'output': ['7205682901\\r\\n']}, {'input': '2210 4888521\\r\\n', 'output': ['7195910279\\r\\n']}, {'input': '2212 4888521\\r\\n', 'output': ['7215455655\\r\\n']}, {'input': '2211 4888520\\r\\n', 'output': ['7205682901\\r\\n']}, {'input': '2211 4888522\\r\\n', 'output': ['7205682901\\r\\n']}, {'input': '3918476 1038587\\r\\n', 'output': ['8137939762176\\r\\n']}]","id":57} {"description":"Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a programmed device. It always moves along the same trajectory, which is a polyline with vertices at the points (x0,\u2009y0,\u2009z0), (x1,\u2009y1,\u2009z1), ..., (xn,\u2009yn,\u2009zn). At the beginning of the game the snitch is positioned at the point (x0,\u2009y0,\u2009z0), and then moves along the polyline at the constant speed vs. The twins have not yet found out how the snitch behaves then. Nevertheless, they hope that the retrieved information will help Harry Potter and his team in the upcoming match against Slytherin. Harry Potter learned that at the beginning the game he will be at the point (Px,\u2009Py,\u2009Pz) and his super fast Nimbus 2011 broom allows him to move at the constant speed vp in any direction or remain idle. vp is not less than the speed of the snitch vs. Harry Potter, of course, wants to catch the snitch as soon as possible. Or, if catching the snitch while it is moving along the polyline is impossible, he wants to hurry the Weasley brothers with their experiments. Harry Potter catches the snitch at the time when they are at the same point. Help Harry.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u200910000). The following n\u2009+\u20091 lines contain the coordinates xi, yi, zi, separated by single spaces. The coordinates of any two consecutive points do not coincide. The next line contains the velocities vp and vs, the last line contains Px, Py, Pz, separated by single spaces. All the numbers in the input are integers, their absolute value does not exceed 104. The speeds are strictly positive. It is guaranteed that vs\u2009\u2264\u2009vp.","output_specification":"If Harry Potter can catch the snitch while it is moving along the polyline (including the end (xn,\u2009yn,\u2009zn)), print \"YES\" in the first line (without the quotes). Print in the second line t, which is the earliest moment of time, when Harry will be able to catch the snitch. On the third line print three numbers X, Y, Z, the coordinates of the point at which this happens. The absolute or relative error in the answer should not exceed 10\u2009-\u20096. If Harry is not able to catch the snitch during its moving along the described polyline, print \"NO\".","notes":null,"sample_inputs":["4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 25","4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 50","1\n1 2 3\n4 5 6\n20 10\n1 2 3"],"sample_outputs":["YES\n25.5000000000\n10.0000000000 4.5000000000 0.0000000000","NO","YES\n0.0000000000\n1.0000000000 2.0000000000 3.0000000000"],"src_uid":"6e2a8aa58ed8cd308cb482e4c24cbbbb","lang_cluster":"C++","difficulty":2100,"human_solution":"#include \n#include \n#include \n#include \n\nusing namespace std;\n\ndouble cartesian_distance(const vector& a, \n const vector& b) {\n double square_sum = 0;\n\n for(int i = 0; i < 3; ++i) {\n square_sum += (b[i] - a[i]) * (b[i] - a[i]);\n }\n\n return sqrt(square_sum);\n}\n\ninline void read_point(vector& dest) {\n for(int j = 0; j < 3; ++j) {\n int a;\n cin >> a;\n dest[j] = a;\n }\n}\n\nint main() {\n ios_base::sync_with_stdio(false);\n\n cout.setf(ios_base::fixed, ios_base::floatfield);\n cout.precision(10);\n\n int n;\n cin >> n;\n\n vector > lines(n + 1, vector(3));\n\n for(int i = 0; i <= n; ++i) {\n read_point(lines[i]);\n }\n\n int v_potter, v_snitch;\n cin >> v_potter >> v_snitch;\n\n vector potter_start(3);\n read_point(potter_start);\n\n \/\/ General idea: Do a binary search on the time Harry will catch\n \/\/ the snitch. \n \/\/ Let t_left and t_right be the range of times where\n \/\/ you are searching in, and t_middle = (t_left + t_right) \/ 2.\n \/\/ If Harry can reach the ball at t_middle (i.e, if the time it takes\n \/\/ Harry to reach the point where the snitch is at t_middle is <= \n \/\/ t_middle), then we'll search in [t_left, t_middle], otherwise\n \/\/ we'll search in [t_middle, t_right]. Notice that, because \n \/\/ v_potter >= v_snitch, if Harry can catch the snitch at time\n \/\/ t_a, then he will be able to catch it at time t_b > t_a. So the\n \/\/ algorithm will always find the correct answer if it exists.\n \/\/ Also, if Harry can't reach the last point fast enough (i.e before\n \/\/ the snitch), then there is no answer.\n \/\/\n \/\/ We'll need to compute the time it takes reach each particular \n \/\/ line so we know the point where the snitch is at a particular time t\n\n vector times(n + 1);\n\n for(int i = 1; i <= n; ++i) {\n times[i] = times[i - 1] + \n cartesian_distance(lines[i], lines[i - 1]) \/ v_snitch;\n }\n\n const double eps = 1e-12;\n\n if (times[n] + eps < cartesian_distance(potter_start, lines[n]) \/\n v_potter) {\n cout << \"NO\\n\";\n } else {\n \/\/ Possible, start binary search\n double t_left = 0, \n t_right = times[n],\n t_middle;\n\n \n vector point(3);\n\n for(int i = 0; i < 150; ++i) {\n t_middle = (t_left + t_right) \/ 2;\n\n \/\/ Find the line where t_middle belongs\n \/\/ index is the second point of the line\n int index = upper_bound(times.begin(), times.end(), t_middle) -\n times.begin();\n\n index = min(index, n);\n\n double segment_time = t_middle - times[index - 1];\n double factor = segment_time \/ (times[index] - times[index - 1]);\n\n \/\/ Compute point\n for(int i = 0; i < 3; ++i) {\n point[i] = lines[index - 1][i] + \n factor * (lines[index][i] - lines[index - 1][i]);\n }\n\n double potter_distance = cartesian_distance(point, potter_start);\n double potter_time = potter_distance \/ v_potter;\n\n if (abs(potter_time - t_middle) <= eps) {\n break;\n } else if (potter_time > t_middle) {\n \/\/ Search right\n t_left = t_middle;\n } else {\n t_right = t_middle;\n }\n }\n\n cout << \"YES\\n\";\n cout << t_middle << '\\n';\n cout << point[0] << ' ' << point[1] << ' ' << point[2] << '\\n';\n }\n}\n","testcases":"[{'input': '4\\r\\n0 0 0\\r\\n0 10 0\\r\\n10 10 0\\r\\n10 0 0\\r\\n0 0 0\\r\\n1 1\\r\\n5 5 25\\r\\n', 'output': ['YES\\r\\n25.5000000000\\r\\n10.0000000000 4.5000000000 0.0000000000\\r\\n']}, {'input': '4\\r\\n0 0 0\\r\\n0 10 0\\r\\n10 10 0\\r\\n10 0 0\\r\\n0 0 0\\r\\n1 1\\r\\n5 5 50\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1\\r\\n1 2 3\\r\\n4 5 6\\r\\n20 10\\r\\n1 2 3\\r\\n', 'output': ['YES\\r\\n0.0000000000\\r\\n1.0000000000 2.0000000000 3.0000000000\\r\\n']}, {'input': '4\\r\\n0 0 0\\r\\n0 1 0\\r\\n1 1 0\\r\\n1 0 0\\r\\n0 0 0\\r\\n10 5\\r\\n0 0 8\\r\\n', 'output': ['YES\\r\\n0.8000000000\\r\\n0.0000000000 0.0000000000 0.0000000000\\r\\n']}, {'input': '4\\r\\n1 0 0\\r\\n0 1 0\\r\\n-1 0 0\\r\\n0 -1 0\\r\\n1 0 0\\r\\n10 5\\r\\n9 0 -8\\r\\n', 'output': ['YES\\r\\n1.1313708499\\r\\n1.0000000000 0.0000000000 0.0000000000\\r\\n']}, {'input': '5\\r\\n32 -5 -42\\r\\n-25 -38 -6\\r\\n-13 41 25\\r\\n21 -25 -32\\r\\n43 35 -19\\r\\n-38 -12 -48\\r\\n3 2\\r\\n182 -210 32\\r\\n', 'output': ['YES\\r\\n97.5061769956\\r\\n-0.5611252637 16.8539490414 4.1465923539\\r\\n']}, {'input': '10\\r\\n-20 28 4\\r\\n-12 -34 49\\r\\n3 -11 25\\r\\n-35 -46 25\\r\\n4 29 -15\\r\\n17 16 -10\\r\\n40 -35 16\\r\\n-15 -25 10\\r\\n-2 40 20\\r\\n-26 18 -49\\r\\n14 8 -44\\r\\n3 1\\r\\n-877 450 899\\r\\n', 'output': ['YES\\r\\n437.7804049730\\r\\n-6.8291526407 15.8542367965 16.2852671995\\r\\n']}, {'input': '1\\r\\n5 -22 -3\\r\\n31 -41 -35\\r\\n4 4\\r\\n139 -86 -115\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2\\r\\n-34 37 40\\r\\n24 -28 7\\r\\n-20 -14 -25\\r\\n1 1\\r\\n-69 -28 -70\\r\\n', 'output': ['YES\\r\\n107.2130636667\\r\\n12.9900466281 -24.4968330180 -1.0072388159\\r\\n']}, {'input': '3\\r\\n-38 -39 -19\\r\\n-49 -16 50\\r\\n-3 -7 5\\r\\n28 -15 41\\r\\n1 1\\r\\n-100 -139 -33\\r\\n', 'output': ['NO\\r\\n']}, {'input': '15\\r\\n-17 -8 7\\r\\n-50 -28 8\\r\\n13 -38 -17\\r\\n27 -49 15\\r\\n34 49 17\\r\\n-17 36 25\\r\\n-10 -15 28\\r\\n-15 -36 32\\r\\n-8 47 26\\r\\n-19 18 -25\\r\\n44 36 -16\\r\\n4 -46 49\\r\\n46 20 -13\\r\\n21 -37 -8\\r\\n35 -38 -26\\r\\n-26 46 12\\r\\n4 1\\r\\n-1693 1363 2149\\r\\n', 'output': ['YES\\r\\n768.5953048926\\r\\n37.0198725921 5.8883712161 0.2563785546\\r\\n']}, {'input': '20\\r\\n26 47 23\\r\\n1 -2 17\\r\\n-14 -22 46\\r\\n19 34 -18\\r\\n22 -10 -34\\r\\n15 14 -48\\r\\n-30 -12 -12\\r\\n-23 40 -48\\r\\n-50 -41 -35\\r\\n48 -5 46\\r\\n-2 -11 10\\r\\n-49 47 -15\\r\\n31 6 10\\r\\n-41 35 15\\r\\n28 28 25\\r\\n43 -7 -10\\r\\n-19 -48 49\\r\\n-10 -29 28\\r\\n0 -10 28\\r\\n41 12 -26\\r\\n-14 40 17\\r\\n3 2\\r\\n-115 1407 1434\\r\\n', 'output': ['YES\\r\\n659.9757793192\\r\\n-5.2872973659 35.5644422954 10.1882506679\\r\\n']}, {'input': '1\\r\\n0 0 0\\r\\n0 0 1\\r\\n10000 10000\\r\\n0 0 1\\r\\n', 'output': ['YES\\r\\n0.0000500000\\r\\n0.0000000000 0.0000000000 0.5000000000\\r\\n']}, {'input': '1\\r\\n10000 -10000 10000\\r\\n-10000 10000 -10000\\r\\n1 1\\r\\n10000 10000 10000\\r\\n', 'output': ['YES\\r\\n17320.5080756888\\r\\n0.0000000000 0.0000000000 0.0000000000\\r\\n']}, {'input': '1\\r\\n10000 -10000 10000\\r\\n-10000 10000 -10000\\r\\n10000 1\\r\\n10000 10000 10000\\r\\n', 'output': ['YES\\r\\n1.9998845433\\r\\n9998.8453661206 -9998.8453661206 9998.8453661206\\r\\n']}, {'input': '1\\r\\n0 0 -1\\r\\n0 0 1\\r\\n10000 1\\r\\n0 0 10000\\r\\n', 'output': ['YES\\r\\n1.0000000000\\r\\n0.0000000000 0.0000000000 0.0000000000\\r\\n']}, {'input': '1\\r\\n0 0 0\\r\\n-1 0 0\\r\\n10000 1\\r\\n10000 0 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2\\r\\n10000 10000 10000\\r\\n10000 10000 -10000\\r\\n10000 -10000 -10000\\r\\n1 1\\r\\n-10000 -10000 10000\\r\\n', 'output': ['YES\\r\\n30000.0000000000\\r\\n10000.0000000000 0.0000000000 -10000.0000000000\\r\\n']}, {'input': '4\\r\\n10000 9999 10000\\r\\n10000 9999 9999\\r\\n10000 10000 9999\\r\\n10000 10000 10000\\r\\n10000 9999 10000\\r\\n10000 1\\r\\n-10000 -10000 -10000\\r\\n', 'output': ['YES\\r\\n3.4640748220\\r\\n10000.0000000000 9999.5359251780 10000.0000000000\\r\\n']}, {'input': '3\\r\\n10000 9999 10000\\r\\n10000 9999 9999\\r\\n10000 10000 9999\\r\\n10000 10000 10000\\r\\n10000 1\\r\\n-10000 -10000 -10000\\r\\n', 'output': ['NO\\r\\n']}]","id":58} {"description":"Today you are to solve the problem even the famous Hercule Poirot can't cope with! That's why this crime has not yet been solved and this story was never included in Agatha Christie's detective story books. You are not informed on what crime was committed, when and where the corpse was found and other details. We only know that the crime was committed in a house that has n rooms and m doors between the pairs of rooms. The house residents are very suspicious, that's why all the doors can be locked with keys and all the keys are different. According to the provided evidence on Thursday night all the doors in the house were locked, and it is known in what rooms were the residents, and what kind of keys had any one of them. The same is known for the Friday night, when all the doors were also locked. On Friday it was raining heavily, that's why nobody left the house and nobody entered it. During the day the house residents could open and close doors to the neighboring rooms using the keys at their disposal (every door can be opened and closed from each side); move freely from a room to a room if a corresponding door is open; give keys to one another, being in one room. \"Little grey matter\" of Hercule Poirot are not capable of coping with such amount of information. Find out if the positions of people and keys on the Thursday night could result in the positions on Friday night, otherwise somebody among the witnesses is surely lying.","input_specification":"The first line contains three preset integers n, m \u0438 k (1\u2009\u2264\u2009n,\u2009m,\u2009k\u2009\u2264\u20091000) \u2014 the number of rooms, the number of doors and the number of house residents respectively. The next m lines contain pairs of room numbers which join the doors. The rooms are numbered with integers from 1 to n. There cannot be more that one door between the pair of rooms. No door connects a room with itself. The next k lines describe the residents' position on the first night. Every line contains a resident's name (a non-empty line consisting of no more than 10 Latin letters), then after a space follows the room number, then, after a space \u2014 the number of keys the resident has. Then follow written space-separated numbers of the doors that can be unlocked by these keys. The doors are numbered with integers from 1 to m in the order in which they are described in the input data. All the residents have different names, uppercase and lowercase letters considered to be different. Every m keys occurs exactly once in the description. Multiple people may be present in one room, some rooms may be empty. The next k lines describe the position of the residents on the second night in the very same format. It is guaranteed that in the second night's description the residents' names remain the same and every m keys occurs exactly once.","output_specification":"Print \"YES\" (without quotes) if the second arrangement can result from the first one, otherwise, print \"NO\".","notes":null,"sample_inputs":["2 1 2\n1 2\nDmitry 1 1 1\nNatalia 2 0\nNatalia 1 1 1\nDmitry 2 0","4 4 3\n1 3\n1 2\n2 3\n3 4\nArtem 1 1 4\nDmitry 1 1 2\nEdvard 4 2 1 3\nArtem 2 0\nDmitry 1 0\nEdvard 4 4 1 2 3 4"],"sample_outputs":["YES","NO"],"src_uid":"52b13cca189853e6af02bea8d3d85276","lang_cluster":"C++","difficulty":2300,"human_solution":"#pragma comment(linker, \"\/STACK:10000000\")\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \n#include \n#include \n#include \n\nusing namespace std;\n\n#define forn(i, n) for(int i = 0; i < int(n); ++i)\n#define for1(i, n) for(int i = 1; i <= int(n); ++i)\n#define ford(i, n) for(int i = int(n) - 1; i >= 0; --i)\n#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)\n#define sz(v) int((v).size())\n#define all(v) (v).begin(), (v).end()\n#define pb push_back\n#define X first\n#define Y second\n#define mp make_pair\n#define debug(x) {cerr << #x << \" = \" << x << endl;}\ntemplate inline T abs(T a){ return ((a < 0) ? -a : a); }\ntemplate inline T sqr(T a){ return a * a; }\n\ntypedef long long li;\ntypedef long double ld;\ntypedef pair pt;\n\nconst int INF = (int)1E9 + 7;\nconst ld EPS = 1E-9;\nconst ld PI = 3.1415926535897932384626433832795;\n\nconst int NMAX = 2000;\nint n, m, k;\n\nvector g[NMAX];\nvector e;\n\nmap idx;\n\nint pos1[NMAX], pos2[NMAX];\nvector key1[NMAX];\nvector key2[NMAX];\n\nint c[NMAX];\nvoid init(){\n forn(i, n)\n c[i] = i;\n}\n\nint root(int v){\n return c[v] == v ? v : c[v] = root(c[v]);\n}\n\nbool join(int a, int b){\n a = root(a), b = root(b);\n if(a == b) return false;\n if(rand() & 1) swap(a, b);\n c[a] = b;\n return true;\n}\n\nvector getKeyPos(int* pos, vector* key){\n vector key_pos(m, 0);\n forn(i, k)\n forn(j, sz(key[i]))\n key_pos[key[i][j]] = pos[i];\n return key_pos;\n}\n\nvector getColor(int* pos, vector* key){\n vector key_pos = getKeyPos(pos, key);\n\n init();\n\n bool was = true;\n while(was){\n was = false;\n forn(i, m){\n int u = e[i].X, v = e[i].Y;\n if(root(u) == root(key_pos[i]) || root(v) == root(key_pos[i])){\n if(join(u, v))\n was = true;\n }\n }\n }\n\n vector ans(n);\n map clr;\n forn(i, n){\n int cur = root(i);\n if(!clr.count(cur)){\n int val = sz(clr);\n clr[cur] = val;\n }\n ans[i] = clr[cur];\n }\n return ans;\n}\n\nint main() {\n \/\/freopen(\"input.txt\", \"rt\", stdin);\n \/\/freopen(\"output.txt\", \"wt\", stdout);\n\n scanf(\"%d%d%d\", &n, &m, &k);\n forn(i, m){\n int u, v;\n scanf(\"%d%d\", &u, &v);\n --u, --v;\n e.pb(pt(u, v));\n g[u].pb(v);\n g[v].pb(u);\n }\n\n forn(i, k){\n string name;\n cin >> name;\n if(!idx.count(name)){\n int val = sz(idx);\n idx[name] = val;\n }\n\n scanf(\"%d\", &pos1[idx[name]]);\n pos1[idx[name]]--;\n int cnt;\n scanf(\"%d\", &cnt);\n key1[idx[name]].resize(cnt);\n forn(j, cnt){\n scanf(\"%d\", &key1[idx[name]][j]);\n key1[idx[name]][j]--; \n }\n }\n\n forn(i, k){\n string name;\n cin >> name;\n if(!idx.count(name)){\n int val = sz(idx);\n idx[name] = val;\n }\n\n scanf(\"%d\", &pos2[idx[name]]);\n pos2[idx[name]]--;\n int cnt;\n scanf(\"%d\", &cnt);\n key2[idx[name]].resize(cnt);\n forn(j, cnt){\n scanf(\"%d\", &key2[idx[name]][j]);\n key2[idx[name]][j]--; \n }\n }\n\n vector c1 = getColor(pos1, key1), c2 = getColor(pos2, key2);\n\n if(c1 != c2){\n puts(\"NO\");\n exit(0);\n } \n\n forn(i, k){\n if(c1[pos1[i]] != c2[pos2[i]]){\n puts(\"NO\");\n exit(0);\n } \n }\n\n vector k1 = getKeyPos(pos1, key1), k2 = getKeyPos(pos2, key2);\n\n forn(i, m)\n if(c1[k1[i]] != c2[k2[i]]){\n puts(\"NO\");\n exit(0);\n }\n\n puts(\"YES\");\n return 0;\n}\n\n","testcases":"[{'input': '2 1 2\\r\\n1 2\\r\\nDmitry 1 1 1\\r\\nNatalia 2 0\\r\\nNatalia 1 1 1\\r\\nDmitry 2 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4 4 3\\r\\n1 3\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\nArtem 1 1 4\\r\\nDmitry 1 1 2\\r\\nEdvard 4 2 1 3\\r\\nArtem 2 0\\r\\nDmitry 1 0\\r\\nEdvard 4 4 1 2 3 4\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1 1\\r\\n2 1\\r\\nabsgdf 1 1 1\\r\\nabsgdf 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2 1 1\\r\\n2 1\\r\\nabsgdf 2 1 1\\r\\nabsgdf 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\na 1 1 1\\r\\nb 2 1 3\\r\\nc 3 1 2\\r\\na 3 1 3\\r\\nb 1 0\\r\\nc 2 2 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\na 1 1 1\\r\\nb 2 1 3\\r\\nc 3 1 2\\r\\nb 1 1 2\\r\\nc 2 1 3\\r\\na 3 1 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\nb 1 1 2\\r\\nc 2 1 3\\r\\na 3 1 1\\r\\na 3 1 3\\r\\nb 1 0\\r\\nc 2 2 1 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4 5 3\\r\\n1 2\\r\\n2 3\\r\\n2 4\\r\\n1 3\\r\\n1 3\\r\\na 1 2 4 3\\r\\nb 1 0\\r\\nc 4 3 1 2 5\\r\\na 1 2 4 3\\r\\nb 1 1 5\\r\\nc 4 2 1 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 2 2\\r\\n1 2\\r\\n2 1\\r\\nA 1 1 2\\r\\nB 1 1 1\\r\\nA 1 0\\r\\nB 2 2 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4 2 4\\r\\n2 1\\r\\n4 3\\r\\na 1 1 1\\r\\nb 2 1 2\\r\\nc 3 0\\r\\nd 4 0\\r\\na 2 1 2\\r\\nb 1 1 1\\r\\nc 3 0\\r\\nd 4 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4 2 4\\r\\n2 1\\r\\n4 3\\r\\na 1 1 1\\r\\nb 2 1 2\\r\\nc 3 0\\r\\nd 4 0\\r\\na 2 1 2\\r\\nb 1 1 1\\r\\nc 4 0\\r\\nd 3 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6 3 4\\r\\n1 2\\r\\n3 4\\r\\n5 6\\r\\na 1 2 1 3\\r\\nb 3 1 2\\r\\nc 5 0\\r\\nd 6 0\\r\\na 2 2 1 3\\r\\nb 4 1 2\\r\\nc 5 0\\r\\nd 6 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6 3 4\\r\\n1 2\\r\\n3 4\\r\\n5 6\\r\\na 1 2 1 3\\r\\nb 3 1 2\\r\\nc 5 0\\r\\nd 6 0\\r\\na 2 1 1\\r\\nb 4 2 2 3\\r\\nc 5 0\\r\\nd 6 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10 20 5\\r\\n2 1\\r\\n3 1\\r\\n4 2\\r\\n5 1\\r\\n6 5\\r\\n7 2\\r\\n8 5\\r\\n9 8\\r\\n10 6\\r\\n2 6\\r\\n3 5\\r\\n3 4\\r\\n10 5\\r\\n8 3\\r\\n9 4\\r\\n10 8\\r\\n9 2\\r\\n6 3\\r\\n3 8\\r\\n9 8\\r\\nDKkXdT 10 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\\r\\nOzvgPXMzAr 5 0\\r\\nbjac 3 0\\r\\ncBPbJtoND 6 0\\r\\nw 5 0\\r\\nbjac 4 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\\r\\nOzvgPXMzAr 2 0\\r\\ncBPbJtoND 5 0\\r\\nw 10 0\\r\\nDKkXdT 4 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 9 10\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 8\\r\\n8 9\\r\\n9 10\\r\\nInCeN 1 0\\r\\nIzHqPceNhj 2 1 9\\r\\neH 3 1 8\\r\\nJvgBsNFi 4 1 7\\r\\nBA 5 1 6\\r\\nRrjSTXJzhL 6 1 5\\r\\nDMx 7 1 4\\r\\nJzt 8 1 3\\r\\nhxBRlDlqwD 9 1 2\\r\\nImWeEPkggZ 10 1 1\\r\\neH 1 0\\r\\nImWeEPkggZ 2 1 9\\r\\nDMx 3 1 8\\r\\nIzHqPceNhj 4 1 7\\r\\nInCeN 5 1 6\\r\\nJvgBsNFi 6 1 5\\r\\nRrjSTXJzhL 7 1 4\\r\\nJzt 8 1 3\\r\\nhxBRlDlqwD 9 1 2\\r\\nBA 10 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '11 10 11\\r\\n1 2\\r\\n2 11\\r\\n3 4\\r\\n4 11\\r\\n5 6\\r\\n6 11\\r\\n7 8\\r\\n8 11\\r\\n9 10\\r\\n10 11\\r\\na 1 1 9\\r\\nb 2 1 10\\r\\nc 3 0\\r\\nd 4 1 1\\r\\ne 5 1 3\\r\\nf 6 1 4\\r\\ng 7 1 5\\r\\nh 8 1 6\\r\\ni 9 1 7\\r\\nj 10 1 8\\r\\nk 11 1 2\\r\\na 1 0\\r\\nb 2 0\\r\\nc 3 0\\r\\nd 4 0\\r\\ne 5 0\\r\\nf 6 0\\r\\ng 7 0\\r\\nh 8 0\\r\\ni 9 0\\r\\nj 10 0\\r\\nk 11 10 1 2 3 4 5 6 7 8 9 10\\r\\n', 'output': ['YES\\r\\n']}, {'input': '11 10 11\\r\\n1 2\\r\\n2 11\\r\\n3 4\\r\\n4 11\\r\\n5 6\\r\\n6 11\\r\\n7 8\\r\\n8 11\\r\\n9 10\\r\\n10 11\\r\\na 1 0\\r\\nb 2 0\\r\\nc 3 0\\r\\nd 4 0\\r\\ne 5 0\\r\\nf 6 0\\r\\ng 7 0\\r\\nh 8 0\\r\\ni 9 0\\r\\nj 10 0\\r\\nk 11 10 1 2 3 4 5 6 7 8 9 10\\r\\na 1 1 9\\r\\nb 2 1 10\\r\\nc 3 0\\r\\nd 4 1 1\\r\\ne 5 1 3\\r\\nf 6 1 4\\r\\ng 7 1 5\\r\\nh 8 1 6\\r\\ni 9 1 7\\r\\nj 10 1 8\\r\\nk 11 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '7 8 2\\r\\n3 7\\r\\n7 6\\r\\n1 2\\r\\n4 5\\r\\n1 3\\r\\n5 6\\r\\n4 6\\r\\n2 3\\r\\na 7 4 3 8 5 2\\r\\nb 7 4 4 6 7 1\\r\\na 1 4 3 8 5 2\\r\\nb 4 4 4 6 7 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7 8 2\\r\\n3 7\\r\\n7 6\\r\\n1 2\\r\\n4 5\\r\\n1 3\\r\\n5 6\\r\\n4 6\\r\\n2 3\\r\\na 1 4 3 8 5 2\\r\\nb 4 4 4 6 7 1\\r\\na 3 4 3 8 5 2\\r\\nb 6 4 4 6 7 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '7 7 2\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 1\\r\\na 1 4 1 3 5 7\\r\\nb 2 3 2 4 6\\r\\na 7 4 1 3 5 7\\r\\nb 4 3 2 4 6\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7 7 2\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 1\\r\\na 1 4 1 3 5 7\\r\\nb 2 3 2 4 6\\r\\na 4 4 1 3 5 7\\r\\nb 4 3 2 4 6\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 20 10\\r\\n1 10\\r\\n5 10\\r\\n2 9\\r\\n2 6\\r\\n9 6\\r\\n3 9\\r\\n7 1\\r\\n10 5\\r\\n7 8\\r\\n8 7\\r\\n2 3\\r\\n9 6\\r\\n1 6\\r\\n5 3\\r\\n4 3\\r\\n3 7\\r\\n8 2\\r\\n6 4\\r\\n2 3\\r\\n4 1\\r\\nTjOMmYPRUY 7 3 1 3 9\\r\\nj 6 2 11 15\\r\\nBanBSrUA 4 2 19 20\\r\\ncSWZxzR 8 1 8\\r\\nzVoRlNgt 10 2 6 7\\r\\nWLGaq 1 3 10 13 17\\r\\nKahHtTDj 1 2 2 14\\r\\nrUFZmkpI 6 1 16\\r\\ni 4 3 4 5 12\\r\\nKLGiua 6 1 18\\r\\nWLGaq 10 0\\r\\ncSWZxzR 3 1 4\\r\\nj 2 3 8 13 17\\r\\nrUFZmkpI 7 2 1 19\\r\\nKahHtTDj 5 1 16\\r\\nKLGiua 6 2 2 12\\r\\nBanBSrUA 2 4 6 7 10 15\\r\\nTjOMmYPRUY 9 3 3 9 18\\r\\nzVoRlNgt 10 2 11 20\\r\\ni 2 2 5 14\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 10 10\\r\\n7 10\\r\\n1 2\\r\\n4 3\\r\\n7 4\\r\\n9 2\\r\\n8 7\\r\\n10 8\\r\\n6 10\\r\\n5 2\\r\\n6 10\\r\\nznkkxCkkxv 9 1 10\\r\\nP 5 1 7\\r\\nKOF 1 2 3 9\\r\\nwYtfFWkb 3 0\\r\\nZPJiebeu 9 1 6\\r\\ndgzAhKY 4 0\\r\\nayqPf 3 0\\r\\nxFSb 9 0\\r\\nreYnbMDm 10 1 1\\r\\nydSIPy 6 4 2 4 5 8\\r\\nKOF 10 1 4\\r\\nayqPf 7 1 7\\r\\nreYnbMDm 4 1 5\\r\\nwYtfFWkb 5 1 6\\r\\nznkkxCkkxv 9 2 1 9\\r\\nydSIPy 10 0\\r\\nP 10 1 8\\r\\ndgzAhKY 7 1 2\\r\\nZPJiebeu 8 1 3\\r\\nxFSb 7 1 10\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 8 5\\r\\n1 3\\r\\n4 2\\r\\n1 3\\r\\n4 2\\r\\n1 5\\r\\n5 3\\r\\n2 5\\r\\n2 5\\r\\nTaMmKIk 1 0\\r\\nvrLryIxio 1 3 1 6 5\\r\\nGFKONi 2 1 4\\r\\nTzRVfh 3 2 3 8\\r\\nqp 4 2 7 2\\r\\nTaMmKIk 1 2 7 4\\r\\nvrLryIxio 1 3 1 6 5\\r\\nTzRVfh 3 1 8\\r\\nqp 4 1 3\\r\\nGFKONi 4 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 9 10\\r\\n4 7\\r\\n4 8\\r\\n8 3\\r\\n9 2\\r\\n8 3\\r\\n8 1\\r\\n6 9\\r\\n4 7\\r\\n7 4\\r\\nznkkxCkkxv 1 2 3 6\\r\\nQlf 3 0\\r\\nKOF 5 2 1 8\\r\\ndgzAhKY 5 0\\r\\nwYtfFWkb 6 2 4 7\\r\\nLbYfZPhWd 9 0\\r\\nP 10 1 9\\r\\nZPJiebeu 10 1 5\\r\\nayqPf 10 0\\r\\nzmZLwuf 10 1 2\\r\\nwYtfFWkb 2 2 7 4\\r\\nQlf 3 1 2\\r\\nznkkxCkkxv 3 3 6 3 9\\r\\nKOF 5 0\\r\\ndgzAhKY 5 0\\r\\nLbYfZPhWd 9 0\\r\\nP 10 1 5\\r\\nZPJiebeu 10 0\\r\\nayqPf 10 0\\r\\nzmZLwuf 10 2 1 8\\r\\n', 'output': ['NO\\r\\n']}]","id":59} {"description":"Once a walrus professor Plato asked his programming students to perform the following practical task. The students had to implement such a data structure that would support a convex hull on some set of points S. The input to the program had q queries of two types: 1. Add a point with coordinates (x,\u2009y) into the set S. Note that in this case the convex hull of S could have changed, and could have remained the same. 2. Say whether a point with coordinates (x,\u2009y) belongs to an area limited by the convex hull, including the border. All the students coped with the task. What about you?","input_specification":"The first line contains an integer q (4\u2009\u2264\u2009q\u2009\u2264\u2009105). Then follow q lines in the following way: \"t x y\", where t is the query type (1 or 2), and (x,\u2009y) are the coordinates of the point (\u2009-\u2009106\u2009\u2264\u2009x,\u2009y\u2009\u2264\u2009106, x and y are integers). There is at least one query of type 2. It is guaranteed that the three queries of the first type follow first and the points given in the queries form a non-degenerative triangle. Also all the points added in S are distinct.","output_specification":"For each query of the second type print one string containing \"YES\", if the point lies inside the convex hull or on its border. Otherwise, print \"NO\".","notes":null,"sample_inputs":["8\n1 0 0\n1 2 0\n1 2 2\n2 1 0\n1 0 2\n2 1 1\n2 2 1\n2 20 -1"],"sample_outputs":["YES\nYES\nYES\nNO"],"src_uid":"6220f4058f9325dfb211fb1dd86e9464","lang_cluster":"C++","difficulty":2700,"human_solution":"#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\n#define inf 1000000000\n#define eps 1e-9\n\ninline int sgn(double a) {if (a > eps) return 1; else if (a < -eps) return -1; return 0;}\n\nstruct point {\n double x, y;\n double ang, l;\n point(double x, double y) : x(x), y(y) {l = len(); if (sgn(x) && sgn(y)) ang = angle();}\n point() {}\n inline void read() {int a, b; scanf(\"%d%d\", &a, &b); x = a, y = b; *this = point(x, y);}\n inline double len() const {return sqrt(x * x + y * y);}\n inline double len2() const {return x * x + y * y;}\n inline double angle() {return atan2(y, x);}\n inline double slope() {return y \/ x;}\n inline int part() {\n return (int)(y > 0 || (sgn(y) == 0 && x > 0));\n }\n inline void normalize() {\n double r = 1.0 \/ len();\n x *= r; y *= r;\n }\n inline point getNormal() {\n point ret = *this;\n ret.normalize();\n return ret;\n }\n};\n\ninline point operator -(const point &a, const point &b) {return point(a.x - b.x, a.y - b.y);}\ninline point operator +(const point &a, const point &b) {return point(a.x + b.x, a.y + b.y);}\ninline point operator *(const point &a, double b) {return point(b * a.x, b * a.y);}\ninline point operator *(double b, const point &a) {return point(b * a.x, b * a.y);}\ninline double operator *(const point &a, const point &b) {return a.x * b.x + a.y * b.y;}\ninline double operator %(const point &a, const point &b) {return a.x * b.y - a.y * b.x;}\ninline bool operator ==(const point &a, const point &b) {return sgn(a.x - b.x) == 0 && sgn(a.y - b.y) == 0;}\ninline bool operator !=(const point &a, const point &b) {return !(a == b);}\ninline double dist(const point &a, const point &b) {return (a - b).len();}\n\nbool operator <(point a, point b) {\n if (a.part() != b.part()) return b.part();\n int tmp = sgn(a % b);\n if (tmp) return tmp == 1;\n return a.len() + eps < b.len();\n}\n\nint n;\n\nset S;\n\ntypedef set::iterator it;\n\nvoid print() {\n for (it i = S.begin(); i != S.end(); i++) printf(\"%lf %lf %lf\\n\", i->x, i->y, i->ang);\n}\n\nit getPrev(it p) {\n if (p == S.begin()) p = S.end();\n p--;\n return p;\n}\n\nit getNext(it p) {\n p++;\n if (p == S.end()) p = S.begin();\n return p;\n}\n\nbool Inside(point p) {\n\/\/ print();\n it t1 = S.upper_bound(p);\n if (t1 == S.end()) t1 = S.begin();\n it t0 = getPrev(t1);\n\/\/ printf(\"%lf %lf\\n\", t0->x, t0->y);\n\/\/ printf(\"%lf %lf\\n\", t1->x, t1->y);\n return sgn((p - *t0) % (*t1 - *t0)) <= 0;\n}\n\nvoid Insert(point p) {\n if (Inside(p)) return;\n S.insert(p);\n it tmp = S.lower_bound(p);\n if (tmp != S.begin()) {\n tmp--;\n if (sgn(tmp->ang == p.ang)) S.erase(tmp);\n }\n while (true && S.size() > 3) {\n it t0 = getPrev(S.lower_bound(p)), t1 = getPrev(t0);\n if (sgn((*t0 - p) % (*t1 - p)) >= 0) S.erase(t0);\n else break;\n }\n while (true && S.size() > 3) {\n it t0 = getNext(S.lower_bound(p)), t1 = getNext(t0);\n if (sgn((*t0 - p) % (*t1 - p)) <= 0) S.erase(t0);\n else break;\n }\n}\n\n\nint main() {\n\/\/ freopen(\"data.in\", \"r\", stdin);\n scanf(\"%d\", &n);\n point S[3];\n for (int i = 0; i < 3; i++) scanf(\"%*d\"), S[i].read();\n point O = (S[0] + S[1] + S[2]) * (1.0 \/ 3.0);\n ::S.insert(S[0] - O); ::S.insert(S[1] - O); ::S.insert(S[2] - O);\n n -= 3;\n for (int i = 0; i < n; i++) {\n int ctrl; scanf(\"%d\", &ctrl);\n point p; p.read(); p = p - O;\n if (ctrl == 2) printf(\"%s\\n\", Inside(p) ? \"YES\" : \"NO\");\n else Insert(p);\n }\n return 0;\n}\n","testcases":"[{'input': '8\\r\\n1 0 0\\r\\n1 2 0\\r\\n1 2 2\\r\\n2 1 0\\r\\n1 0 2\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 20 -1\\r\\n', 'output': ['YES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 0 0\\r\\n1 5 0\\r\\n1 0 5\\r\\n2 1 1\\r\\n2 10 10\\r\\n1 2 10\\r\\n2 1 1\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '5\\r\\n1 2 -2\\r\\n1 -2 2\\r\\n1 1 5\\r\\n2 3 -1\\r\\n2 3 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\n']}, {'input': '5\\r\\n1 -1 0\\r\\n1 1 0\\r\\n1 0 2\\r\\n2 0 1\\r\\n2 0 3\\r\\n', 'output': ['YES\\r\\nNO\\r\\n']}, {'input': '6\\r\\n1 -2 0\\r\\n1 2 0\\r\\n1 0 2\\r\\n2 4 0\\r\\n2 1 0\\r\\n2 2 0\\r\\n', 'output': ['NO\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '11\\r\\n1 0 -1\\r\\n1 0 1\\r\\n1 1 -1\\r\\n1 -1 -5\\r\\n1 0 5\\r\\n2 5 1\\r\\n2 5 0\\r\\n2 5 -1\\r\\n2 0 0\\r\\n2 0 10\\r\\n2 0 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '30\\r\\n1 -37 889\\r\\n1 771 -764\\r\\n1 -119 938\\r\\n1 599 868\\r\\n1 56 161\\r\\n1 -67 86\\r\\n2 -692 99\\r\\n2 -995 158\\r\\n2 410 116\\r\\n1 -49 -864\\r\\n2 30 -580\\r\\n1 -930 454\\r\\n1 -706 301\\r\\n2 547 -606\\r\\n2 -252 -55\\r\\n2 662 152\\r\\n2 -621 -920\\r\\n1 -128 -595\\r\\n1 -401 -265\\r\\n1 434 388\\r\\n2 299 173\\r\\n1 104 -298\\r\\n1 -693 557\\r\\n2 840 -179\\r\\n2 382 -8\\r\\n1 461 618\\r\\n1 -928 628\\r\\n2 193 -972\\r\\n2 218 945\\r\\n2 490 571\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '30\\r\\n1 -619 -234\\r\\n1 -140 -846\\r\\n1 762 -792\\r\\n2 153 29\\r\\n1 -353 627\\r\\n2 -544 -418\\r\\n2 -922 -965\\r\\n1 -620 -692\\r\\n1 -34 295\\r\\n2 -326 -604\\r\\n2 -906 -867\\r\\n2 57 -690\\r\\n1 -87 -822\\r\\n2 -569 739\\r\\n2 -92 -927\\r\\n2 279 806\\r\\n1 -364 19\\r\\n2 -214 -629\\r\\n2 -283 662\\r\\n2 -324 650\\r\\n1 92 -511\\r\\n2 654 -597\\r\\n1 -87 747\\r\\n2 795 46\\r\\n2 870 -157\\r\\n2 -11 520\\r\\n1 -162 -686\\r\\n2 290 -660\\r\\n2 -660 780\\r\\n2 946 910\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '30\\r\\n1 -702 -823\\r\\n1 -330 -896\\r\\n1 -564 90\\r\\n1 559 818\\r\\n2 404 716\\r\\n1 -900 -379\\r\\n2 866 -218\\r\\n2 444 615\\r\\n2 -782 -887\\r\\n2 584 -919\\r\\n2 891 775\\r\\n1 117 887\\r\\n2 598 162\\r\\n2 759 -925\\r\\n2 713 -507\\r\\n1 -329 120\\r\\n2 546 185\\r\\n2 399 500\\r\\n1 -611 763\\r\\n1 -956 187\\r\\n2 82 -26\\r\\n2 -877 -906\\r\\n1 293 -637\\r\\n2 -685 -275\\r\\n2 -725 -927\\r\\n1 -627 777\\r\\n1 -609 -563\\r\\n2 402 54\\r\\n1 -106 -908\\r\\n2 175 808\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '30\\r\\n1 -64 -994\\r\\n1 -692 366\\r\\n1 -72 847\\r\\n2 -963 -251\\r\\n1 -651 -994\\r\\n1 -523 -861\\r\\n2 553 -129\\r\\n2 17 785\\r\\n2 -584 -880\\r\\n1 105 657\\r\\n1 649 98\\r\\n2 -572 -492\\r\\n1 -38 -481\\r\\n1 540 463\\r\\n1 -468 -540\\r\\n1 -730 100\\r\\n1 606 -119\\r\\n1 -254 -380\\r\\n1 169 280\\r\\n1 319 62\\r\\n1 452 -556\\r\\n1 -653 887\\r\\n1 407 -786\\r\\n2 -632 181\\r\\n1 925 -967\\r\\n2 996 -709\\r\\n1 568 517\\r\\n2 -478 76\\r\\n1 156 621\\r\\n2 -592 899\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '30\\r\\n1 836 -283\\r\\n1 299 629\\r\\n1 434 -481\\r\\n1 -500 -368\\r\\n2 -105 -216\\r\\n2 -617 443\\r\\n2 -579 811\\r\\n1 411 -242\\r\\n1 -652 41\\r\\n1 962 -483\\r\\n1 -732 579\\r\\n2 554 -147\\r\\n1 39 967\\r\\n1 917 -199\\r\\n2 686 397\\r\\n1 444 780\\r\\n1 278 462\\r\\n1 729 -18\\r\\n1 252 -864\\r\\n1 884 -952\\r\\n1 272 689\\r\\n2 366 -389\\r\\n1 443 924\\r\\n1 791 -249\\r\\n2 692 74\\r\\n2 -412 550\\r\\n2 506 -472\\r\\n2 -626 474\\r\\n1 -895 -42\\r\\n2 -390 -971\\r\\n', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '12\\r\\n1 0 0\\r\\n1 10 0\\r\\n1 8 1\\r\\n2 11 0\\r\\n1 2 0\\r\\n2 7 0\\r\\n2 9 0\\r\\n2 1 0\\r\\n1 1 1\\r\\n2 10 0\\r\\n2 9 0\\r\\n2 11 0\\r\\n', 'output': ['NO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 1 0\\r\\n1 3 0\\r\\n1 5000 5000\\r\\n2 3 0\\r\\n2 2 0\\r\\n2 4 0\\r\\n2 -1 0\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '4\\r\\n1 1 0\\r\\n1 3 0\\r\\n1 2 2\\r\\n2 4 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n1 1 0\\r\\n1 3 0\\r\\n1 0 8\\r\\n2 4 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '11\\r\\n1 0 -1\\r\\n1 0 1\\r\\n1 -1 -5\\r\\n1 6 4\\r\\n1 -8 8\\r\\n2 6 -1\\r\\n2 6 1\\r\\n2 1 0\\r\\n2 1 -1\\r\\n2 1 1\\r\\n2 6 0\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '11\\r\\n1 5 4\\r\\n1 5 6\\r\\n1 4 0\\r\\n1 11 9\\r\\n1 -3 13\\r\\n2 11 4\\r\\n2 11 6\\r\\n2 6 5\\r\\n2 6 4\\r\\n2 6 6\\r\\n2 11 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -2 -1000000\\r\\n1 -1 -1000000\\r\\n1 -1 -999999\\r\\n1 1 1000000\\r\\n1 -231100 1000000\\r\\n2 0 0\\r\\n2 1 999999\\r\\n', 'output': ['YES\\r\\nNO\\r\\n']}, {'input': '10\\r\\n1 -1000000 -1000000\\r\\n1 -999999 -1000000\\r\\n1 999999 1000000\\r\\n1 1000000 1000000\\r\\n2 0 0\\r\\n2 1000000 999999\\r\\n2 999999 1000000\\r\\n2 999999 999999\\r\\n2 999999 999998\\r\\n2 999999 999997\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '9\\r\\n1 -2 -4\\r\\n1 2 4\\r\\n1 -3 3\\r\\n2 -1 -2\\r\\n2 -4 -8\\r\\n2 -3 -6\\r\\n2 1 2\\r\\n2 4 8\\r\\n2 3 6\\r\\n', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '16\\r\\n1 -10000 0\\r\\n1 10000 0\\r\\n1 0 -1\\r\\n2 50000 0\\r\\n2 -50000 0\\r\\n2 49000 0\\r\\n2 -49000 0\\r\\n2 27000 0\\r\\n2 -27000 0\\r\\n1 0 1\\r\\n2 50000 0\\r\\n2 -50000 0\\r\\n2 49000 0\\r\\n2 -49000 0\\r\\n2 27000 0\\r\\n2 -27000 0\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -7000 -9000\\r\\n1 7000 9000\\r\\n1 7000 -7000\\r\\n2 21 27\\r\\n2 -21 -27\\r\\n2 7007 9009\\r\\n2 -7007 -9009\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -7000 -9000\\r\\n1 7000 9000\\r\\n1 -7000 7000\\r\\n2 21 27\\r\\n2 -21 -27\\r\\n2 7007 9009\\r\\n2 -7007 -9009\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -9000 7000\\r\\n1 9000 -7000\\r\\n1 7000 7000\\r\\n2 -27 21\\r\\n2 27 -21\\r\\n2 -9009 7007\\r\\n2 9009 -7007\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -9000 7000\\r\\n1 9000 -7000\\r\\n1 -7000 -7000\\r\\n2 -27 21\\r\\n2 27 -21\\r\\n2 -9009 7007\\r\\n2 9009 -7007\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 7 6\\r\\n1 0 5\\r\\n1 0 4\\r\\n1 2 5\\r\\n1 8 0\\r\\n1 6 4\\r\\n1 1 1\\r\\n1 8 4\\r\\n2 1 1\\r\\n2 2 7\\r\\n1 2 3\\r\\n1 4 2\\r\\n2 4 3\\r\\n1 3 2\\r\\n1 7 2\\r\\n1 1 0\\r\\n2 3 5\\r\\n1 6 5\\r\\n2 5 7\\r\\n2 1 1\\r\\n2 3 2\\r\\n1 6 2\\r\\n2 6 0\\r\\n2 8 8\\r\\n1 4 6\\r\\n1 3 5\\r\\n2 3 8\\r\\n2 0 5\\r\\n2 1 6\\r\\n1 8 3\\r\\n1 2 2\\r\\n1 8 2\\r\\n1 6 8\\r\\n1 1 3\\r\\n1 3 3\\r\\n1 5 5\\r\\n2 2 0\\r\\n2 6 7\\r\\n2 1 6\\r\\n2 6 4\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 3 8\\r\\n1 6 7\\r\\n1 7 7\\r\\n2 5 5\\r\\n1 4 0\\r\\n1 0 0\\r\\n2 7 3\\r\\n1 0 2\\r\\n2 8 2\\r\\n2 5 1\\r\\n2 1 2\\r\\n2 1 5\\r\\n1 1 3\\r\\n1 7 1\\r\\n1 8 7\\r\\n1 2 4\\r\\n1 2 8\\r\\n2 8 5\\r\\n2 8 6\\r\\n1 2 1\\r\\n1 5 6\\r\\n1 2 3\\r\\n2 4 3\\r\\n1 8 3\\r\\n1 1 5\\r\\n2 2 2\\r\\n2 8 5\\r\\n1 0 7\\r\\n1 7 2\\r\\n1 5 5\\r\\n1 8 4\\r\\n1 4 1\\r\\n2 3 2\\r\\n2 6 0\\r\\n2 8 7\\r\\n2 5 7\\r\\n1 3 0\\r\\n2 1 0\\r\\n2 0 7\\r\\n2 5 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 8\\r\\n1 3 8\\r\\n1 7 4\\r\\n1 4 5\\r\\n1 4 1\\r\\n2 6 6\\r\\n2 5 8\\r\\n1 5 4\\r\\n1 7 8\\r\\n2 1 3\\r\\n2 6 1\\r\\n2 8 2\\r\\n2 6 8\\r\\n1 4 3\\r\\n2 2 8\\r\\n2 0 6\\r\\n1 0 3\\r\\n2 0 3\\r\\n1 6 6\\r\\n1 5 8\\r\\n1 5 5\\r\\n1 1 2\\r\\n2 6 7\\r\\n1 4 8\\r\\n2 1 2\\r\\n2 2 7\\r\\n2 2 3\\r\\n1 8 4\\r\\n2 8 4\\r\\n2 6 5\\r\\n1 8 2\\r\\n2 7 2\\r\\n2 3 5\\r\\n1 4 0\\r\\n2 6 2\\r\\n2 3 7\\r\\n1 4 6\\r\\n1 8 6\\r\\n1 0 5\\r\\n2 2 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 4 0\\r\\n1 7 1\\r\\n1 8 0\\r\\n1 1 2\\r\\n1 1 8\\r\\n1 6 1\\r\\n2 5 2\\r\\n1 7 7\\r\\n1 6 5\\r\\n2 8 1\\r\\n2 8 7\\r\\n1 7 8\\r\\n2 3 5\\r\\n2 6 6\\r\\n1 4 2\\r\\n1 8 3\\r\\n2 6 8\\r\\n1 4 8\\r\\n2 4 6\\r\\n2 1 7\\r\\n1 4 3\\r\\n2 0 8\\r\\n1 5 2\\r\\n2 5 5\\r\\n2 1 6\\r\\n1 5 5\\r\\n1 1 5\\r\\n2 3 3\\r\\n2 0 1\\r\\n1 1 0\\r\\n2 1 4\\r\\n2 3 6\\r\\n1 4 6\\r\\n2 7 6\\r\\n1 4 4\\r\\n1 7 6\\r\\n1 6 8\\r\\n2 1 1\\r\\n1 0 1\\r\\n2 0 2\\r\\n', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 3 0\\r\\n1 1 4\\r\\n1 2 7\\r\\n2 4 0\\r\\n1 0 5\\r\\n1 7 5\\r\\n2 6 3\\r\\n1 0 7\\r\\n2 5 7\\r\\n1 1 0\\r\\n2 0 6\\r\\n1 6 8\\r\\n1 3 5\\r\\n1 8 5\\r\\n1 0 6\\r\\n2 7 0\\r\\n1 4 6\\r\\n1 5 2\\r\\n2 6 2\\r\\n1 7 0\\r\\n2 6 3\\r\\n1 3 7\\r\\n2 4 2\\r\\n2 1 4\\r\\n1 1 3\\r\\n1 5 0\\r\\n2 0 7\\r\\n2 6 8\\r\\n1 4 0\\r\\n2 5 0\\r\\n2 3 2\\r\\n2 6 7\\r\\n1 7 2\\r\\n1 0 3\\r\\n1 6 6\\r\\n2 4 0\\r\\n2 2 4\\r\\n1 6 5\\r\\n2 0 8\\r\\n2 0 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 0 3\\r\\n1 6 0\\r\\n1 8 7\\r\\n2 2 6\\r\\n2 7 2\\r\\n2 7 5\\r\\n1 4 7\\r\\n1 2 3\\r\\n2 2 7\\r\\n2 3 1\\r\\n1 3 5\\r\\n1 8 5\\r\\n2 6 8\\r\\n1 2 8\\r\\n2 4 6\\r\\n1 7 3\\r\\n1 3 3\\r\\n2 2 4\\r\\n1 5 0\\r\\n1 5 6\\r\\n1 1 7\\r\\n2 3 3\\r\\n1 8 6\\r\\n2 7 4\\r\\n1 7 8\\r\\n1 5 8\\r\\n2 3 8\\r\\n1 6 6\\r\\n2 8 5\\r\\n1 5 1\\r\\n2 4 2\\r\\n1 7 7\\r\\n2 4 8\\r\\n1 6 1\\r\\n1 1 5\\r\\n2 1 8\\r\\n2 4 3\\r\\n1 5 5\\r\\n1 4 0\\r\\n2 0 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 5 2\\r\\n1 5 6\\r\\n1 2 1\\r\\n2 7 2\\r\\n2 6 2\\r\\n2 0 8\\r\\n2 0 6\\r\\n1 6 8\\r\\n1 2 0\\r\\n1 0 5\\r\\n2 3 0\\r\\n1 3 8\\r\\n2 8 6\\r\\n1 0 3\\r\\n1 8 8\\r\\n2 1 1\\r\\n1 1 4\\r\\n1 1 3\\r\\n2 0 0\\r\\n2 5 6\\r\\n1 0 0\\r\\n2 0 0\\r\\n1 2 7\\r\\n2 0 0\\r\\n2 3 6\\r\\n1 3 3\\r\\n1 3 2\\r\\n1 5 3\\r\\n1 7 8\\r\\n1 7 4\\r\\n1 8 7\\r\\n1 7 3\\r\\n2 0 3\\r\\n1 4 4\\r\\n2 5 0\\r\\n1 6 6\\r\\n1 8 0\\r\\n2 6 2\\r\\n2 4 8\\r\\n2 7 2\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 4\\r\\n1 1 5\\r\\n1 3 5\\r\\n2 8 2\\r\\n2 5 2\\r\\n1 7 3\\r\\n1 8 1\\r\\n2 6 5\\r\\n1 4 3\\r\\n1 2 4\\r\\n1 2 3\\r\\n2 8 3\\r\\n2 3 5\\r\\n2 2 0\\r\\n1 6 7\\r\\n2 2 8\\r\\n1 3 0\\r\\n2 5 1\\r\\n2 2 1\\r\\n1 4 5\\r\\n2 1 6\\r\\n1 8 5\\r\\n2 7 4\\r\\n2 2 0\\r\\n1 3 2\\r\\n1 2 2\\r\\n1 8 3\\r\\n2 3 4\\r\\n1 7 6\\r\\n1 3 7\\r\\n1 5 3\\r\\n1 2 0\\r\\n2 5 7\\r\\n2 0 7\\r\\n2 3 2\\r\\n2 1 0\\r\\n1 6 0\\r\\n2 8 5\\r\\n1 3 4\\r\\n2 0 3\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 8 7\\r\\n1 0 6\\r\\n1 5 0\\r\\n2 6 7\\r\\n2 6 8\\r\\n1 3 5\\r\\n1 6 7\\r\\n1 0 0\\r\\n2 1 7\\r\\n1 2 3\\r\\n2 4 3\\r\\n2 5 5\\r\\n1 4 7\\r\\n2 2 0\\r\\n1 2 4\\r\\n1 4 2\\r\\n1 0 8\\r\\n2 0 3\\r\\n1 8 8\\r\\n2 8 1\\r\\n2 8 6\\r\\n2 4 8\\r\\n1 4 0\\r\\n1 6 6\\r\\n2 0 0\\r\\n1 6 2\\r\\n2 5 1\\r\\n1 3 0\\r\\n1 5 6\\r\\n1 8 1\\r\\n1 3 4\\r\\n1 1 3\\r\\n1 5 1\\r\\n1 5 7\\r\\n1 6 8\\r\\n1 1 5\\r\\n1 1 1\\r\\n1 6 1\\r\\n1 1 4\\r\\n2 7 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 8\\r\\n1 4 0\\r\\n1 0 6\\r\\n2 3 8\\r\\n2 4 5\\r\\n1 5 0\\r\\n2 7 6\\r\\n2 6 1\\r\\n2 1 7\\r\\n1 1 2\\r\\n1 5 4\\r\\n1 7 3\\r\\n2 6 4\\r\\n1 3 0\\r\\n2 2 8\\r\\n1 8 2\\r\\n1 8 8\\r\\n1 7 8\\r\\n2 2 5\\r\\n2 2 3\\r\\n2 4 6\\r\\n2 0 2\\r\\n2 6 7\\r\\n2 2 8\\r\\n1 8 3\\r\\n2 5 5\\r\\n1 4 8\\r\\n1 7 1\\r\\n2 7 3\\r\\n2 4 5\\r\\n2 1 1\\r\\n2 4 2\\r\\n1 1 1\\r\\n2 4 0\\r\\n1 2 4\\r\\n2 7 0\\r\\n1 4 1\\r\\n1 7 5\\r\\n1 6 6\\r\\n2 7 8\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 6 3\\r\\n1 5 3\\r\\n1 3 4\\r\\n1 2 3\\r\\n2 2 5\\r\\n1 6 1\\r\\n2 3 7\\r\\n1 0 0\\r\\n1 8 7\\r\\n1 3 8\\r\\n1 0 8\\r\\n1 3 5\\r\\n1 4 5\\r\\n1 0 5\\r\\n2 8 1\\r\\n2 4 7\\r\\n2 3 2\\r\\n1 6 4\\r\\n2 2 3\\r\\n2 6 3\\r\\n1 0 2\\r\\n2 1 2\\r\\n2 6 2\\r\\n1 5 7\\r\\n2 7 0\\r\\n1 4 8\\r\\n1 4 6\\r\\n2 8 7\\r\\n2 0 7\\r\\n1 7 8\\r\\n2 0 3\\r\\n1 5 5\\r\\n1 6 2\\r\\n2 4 5\\r\\n1 2 5\\r\\n2 3 3\\r\\n2 1 1\\r\\n1 8 3\\r\\n1 6 5\\r\\n2 5 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 6 5\\r\\n1 4 8\\r\\n1 5 7\\r\\n1 3 1\\r\\n2 4 2\\r\\n1 4 3\\r\\n1 0 7\\r\\n2 4 6\\r\\n2 4 2\\r\\n1 0 3\\r\\n2 1 5\\r\\n2 5 6\\r\\n1 8 8\\r\\n1 1 7\\r\\n1 3 3\\r\\n2 6 7\\r\\n1 7 4\\r\\n1 0 2\\r\\n1 8 4\\r\\n2 4 5\\r\\n2 0 7\\r\\n1 4 1\\r\\n1 4 4\\r\\n1 5 3\\r\\n1 1 0\\r\\n1 4 5\\r\\n2 1 4\\r\\n1 0 6\\r\\n2 1 0\\r\\n1 5 5\\r\\n2 5 6\\r\\n2 8 2\\r\\n2 1 7\\r\\n2 8 1\\r\\n2 0 5\\r\\n1 0 4\\r\\n1 6 6\\r\\n2 1 1\\r\\n1 8 0\\r\\n2 6 3\\r\\n', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 7\\r\\n1 3 3\\r\\n1 6 5\\r\\n1 7 3\\r\\n1 2 8\\r\\n1 3 0\\r\\n2 0 0\\r\\n1 7 7\\r\\n2 6 8\\r\\n2 6 0\\r\\n2 4 7\\r\\n1 7 8\\r\\n2 0 7\\r\\n2 0 5\\r\\n1 6 2\\r\\n1 7 1\\r\\n1 1 1\\r\\n2 4 8\\r\\n2 2 1\\r\\n2 7 0\\r\\n2 5 4\\r\\n1 2 4\\r\\n2 1 3\\r\\n2 0 5\\r\\n2 5 5\\r\\n2 1 4\\r\\n2 5 5\\r\\n1 2 6\\r\\n1 4 4\\r\\n2 0 8\\r\\n1 0 6\\r\\n2 0 5\\r\\n2 4 6\\r\\n2 8 1\\r\\n2 2 0\\r\\n2 3 3\\r\\n1 0 4\\r\\n1 3 7\\r\\n2 3 2\\r\\n2 3 7\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 7\\r\\n1 6 5\\r\\n1 2 0\\r\\n2 4 5\\r\\n1 1 0\\r\\n2 3 4\\r\\n1 7 3\\r\\n2 8 1\\r\\n2 0 0\\r\\n2 2 0\\r\\n1 7 4\\r\\n1 6 3\\r\\n2 8 1\\r\\n2 6 0\\r\\n1 4 7\\r\\n2 4 2\\r\\n1 4 5\\r\\n2 3 7\\r\\n2 6 8\\r\\n2 2 6\\r\\n2 7 4\\r\\n1 0 6\\r\\n2 1 7\\r\\n1 4 4\\r\\n2 2 3\\r\\n1 1 3\\r\\n1 8 5\\r\\n1 0 5\\r\\n1 1 1\\r\\n1 4 3\\r\\n2 5 3\\r\\n1 3 6\\r\\n1 7 0\\r\\n2 5 6\\r\\n2 5 6\\r\\n1 0 7\\r\\n2 7 0\\r\\n2 6 4\\r\\n1 3 7\\r\\n2 2 2\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 4 4\\r\\n1 2 6\\r\\n1 8 2\\r\\n2 4 6\\r\\n1 5 4\\r\\n2 5 8\\r\\n2 6 7\\r\\n2 4 8\\r\\n1 1 0\\r\\n1 3 1\\r\\n1 0 3\\r\\n1 8 1\\r\\n1 3 0\\r\\n2 7 4\\r\\n1 2 0\\r\\n1 8 5\\r\\n1 6 2\\r\\n2 2 0\\r\\n1 0 4\\r\\n1 1 1\\r\\n1 4 5\\r\\n2 8 3\\r\\n2 1 0\\r\\n2 5 5\\r\\n1 3 4\\r\\n2 0 7\\r\\n1 4 3\\r\\n1 7 0\\r\\n2 3 8\\r\\n1 0 1\\r\\n1 0 7\\r\\n2 4 1\\r\\n1 0 6\\r\\n2 1 2\\r\\n1 5 7\\r\\n2 7 2\\r\\n2 7 3\\r\\n1 3 6\\r\\n2 7 3\\r\\n2 7 0\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 0 8\\r\\n1 3 5\\r\\n1 0 2\\r\\n1 8 0\\r\\n1 5 3\\r\\n1 5 2\\r\\n2 8 2\\r\\n2 7 6\\r\\n1 6 1\\r\\n2 2 7\\r\\n2 6 5\\r\\n1 3 7\\r\\n2 7 8\\r\\n1 2 4\\r\\n1 4 2\\r\\n2 5 7\\r\\n2 0 6\\r\\n1 3 1\\r\\n2 2 3\\r\\n1 5 7\\r\\n2 2 8\\r\\n1 7 1\\r\\n1 3 0\\r\\n2 5 5\\r\\n1 7 4\\r\\n2 5 5\\r\\n1 2 0\\r\\n2 4 3\\r\\n2 8 1\\r\\n2 8 0\\r\\n1 2 6\\r\\n1 7 5\\r\\n2 4 8\\r\\n1 2 3\\r\\n2 6 6\\r\\n1 7 8\\r\\n2 7 5\\r\\n2 7 4\\r\\n1 8 1\\r\\n2 5 6\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 3\\r\\n1 7 2\\r\\n1 6 2\\r\\n2 0 8\\r\\n2 3 8\\r\\n2 0 3\\r\\n1 5 8\\r\\n2 7 1\\r\\n1 8 1\\r\\n2 8 7\\r\\n1 5 5\\r\\n2 2 4\\r\\n2 3 3\\r\\n2 2 4\\r\\n1 0 1\\r\\n1 2 0\\r\\n1 7 4\\r\\n2 7 4\\r\\n2 5 5\\r\\n1 1 1\\r\\n2 6 4\\r\\n2 1 7\\r\\n2 5 0\\r\\n1 8 0\\r\\n2 6 2\\r\\n1 7 1\\r\\n2 8 6\\r\\n1 8 7\\r\\n2 2 5\\r\\n1 7 3\\r\\n1 5 6\\r\\n1 4 0\\r\\n2 3 8\\r\\n2 8 6\\r\\n1 7 0\\r\\n2 3 5\\r\\n2 6 1\\r\\n1 2 6\\r\\n1 1 2\\r\\n2 7 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 4 4\\r\\n1 2 6\\r\\n1 7 2\\r\\n2 1 4\\r\\n2 0 2\\r\\n1 5 4\\r\\n2 5 1\\r\\n1 0 8\\r\\n1 1 7\\r\\n2 2 0\\r\\n1 8 4\\r\\n2 6 5\\r\\n2 8 0\\r\\n1 6 5\\r\\n2 8 7\\r\\n2 0 0\\r\\n2 4 0\\r\\n2 7 2\\r\\n2 6 8\\r\\n1 7 8\\r\\n2 8 8\\r\\n2 4 7\\r\\n1 7 1\\r\\n2 8 8\\r\\n1 5 8\\r\\n1 3 6\\r\\n1 4 6\\r\\n1 3 5\\r\\n2 6 1\\r\\n2 1 3\\r\\n2 8 4\\r\\n2 8 5\\r\\n2 1 3\\r\\n2 7 1\\r\\n2 5 8\\r\\n1 8 2\\r\\n2 6 1\\r\\n1 7 4\\r\\n1 8 5\\r\\n2 6 4\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 1\\r\\n1 4 7\\r\\n1 1 1\\r\\n1 2 4\\r\\n2 4 4\\r\\n1 4 4\\r\\n2 0 6\\r\\n2 7 6\\r\\n1 4 0\\r\\n2 6 5\\r\\n2 5 2\\r\\n1 6 1\\r\\n2 7 0\\r\\n1 6 2\\r\\n2 3 2\\r\\n1 0 6\\r\\n2 7 0\\r\\n1 8 6\\r\\n2 1 3\\r\\n2 0 1\\r\\n1 2 5\\r\\n1 0 2\\r\\n2 4 2\\r\\n2 6 8\\r\\n2 2 0\\r\\n2 5 7\\r\\n2 6 0\\r\\n1 2 2\\r\\n2 0 3\\r\\n1 7 4\\r\\n2 7 3\\r\\n1 4 1\\r\\n2 2 6\\r\\n2 8 2\\r\\n1 8 3\\r\\n1 8 7\\r\\n1 0 3\\r\\n1 7 0\\r\\n2 2 1\\r\\n2 6 4\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 3 7\\r\\n1 5 8\\r\\n1 4 4\\r\\n1 8 1\\r\\n1 4 6\\r\\n1 6 6\\r\\n2 5 0\\r\\n2 3 4\\r\\n1 5 3\\r\\n2 0 7\\r\\n2 3 1\\r\\n1 5 4\\r\\n1 3 4\\r\\n2 3 4\\r\\n2 8 2\\r\\n1 0 1\\r\\n1 0 8\\r\\n2 3 8\\r\\n1 0 4\\r\\n2 4 6\\r\\n1 7 3\\r\\n2 4 0\\r\\n1 2 3\\r\\n2 8 1\\r\\n2 8 4\\r\\n1 7 0\\r\\n2 2 6\\r\\n2 2 2\\r\\n1 2 2\\r\\n1 6 5\\r\\n1 7 1\\r\\n2 5 1\\r\\n1 2 4\\r\\n2 3 2\\r\\n1 8 4\\r\\n1 7 4\\r\\n1 1 2\\r\\n1 3 2\\r\\n2 7 3\\r\\n2 4 4\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 0\\r\\n1 0 7\\r\\n1 8 4\\r\\n2 1 6\\r\\n2 1 2\\r\\n1 0 0\\r\\n1 1 1\\r\\n2 5 2\\r\\n1 8 5\\r\\n1 0 6\\r\\n2 6 8\\r\\n1 4 2\\r\\n1 8 3\\r\\n2 2 3\\r\\n1 6 3\\r\\n2 6 0\\r\\n1 5 3\\r\\n2 0 5\\r\\n1 3 4\\r\\n2 4 4\\r\\n1 8 6\\r\\n1 1 2\\r\\n1 5 7\\r\\n1 5 1\\r\\n1 3 8\\r\\n2 7 0\\r\\n1 7 2\\r\\n1 3 3\\r\\n2 6 5\\r\\n2 5 0\\r\\n2 2 4\\r\\n2 5 5\\r\\n2 4 6\\r\\n1 6 1\\r\\n1 5 2\\r\\n2 7 5\\r\\n1 8 7\\r\\n1 1 6\\r\\n1 4 8\\r\\n2 8 5\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 8 1\\r\\n1 8 6\\r\\n1 1 1\\r\\n2 5 4\\r\\n2 7 8\\r\\n1 6 2\\r\\n1 7 4\\r\\n1 4 4\\r\\n2 3 7\\r\\n1 6 3\\r\\n2 0 1\\r\\n1 8 0\\r\\n2 0 3\\r\\n1 6 0\\r\\n1 3 4\\r\\n1 1 8\\r\\n1 3 3\\r\\n2 3 1\\r\\n2 4 0\\r\\n1 4 3\\r\\n2 1 3\\r\\n2 5 4\\r\\n1 8 5\\r\\n2 1 0\\r\\n1 4 7\\r\\n2 5 3\\r\\n2 4 1\\r\\n1 4 0\\r\\n1 6 8\\r\\n1 5 1\\r\\n2 8 3\\r\\n2 5 7\\r\\n1 3 2\\r\\n1 7 5\\r\\n1 7 3\\r\\n1 0 8\\r\\n1 7 8\\r\\n2 7 3\\r\\n2 6 7\\r\\n2 4 2\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '50\\r\\n1 58 -49\\r\\n1 -77 -90\\r\\n1 32 -52\\r\\n1 -89 -31\\r\\n1 99 -34\\r\\n1 -3 -59\\r\\n2 65 93\\r\\n2 67 -51\\r\\n2 25 -47\\r\\n1 -72 86\\r\\n2 48 -45\\r\\n2 64 -70\\r\\n2 -96 -43\\r\\n2 87 -58\\r\\n2 3 21\\r\\n2 39 -57\\r\\n1 -58 49\\r\\n2 -1 87\\r\\n2 -63 19\\r\\n2 -27 90\\r\\n2 31 3\\r\\n1 55 41\\r\\n1 90 39\\r\\n1 -53 28\\r\\n2 49 -51\\r\\n2 6 42\\r\\n1 50 15\\r\\n2 21 -2\\r\\n2 -6 70\\r\\n1 -13 -61\\r\\n2 -60 -69\\r\\n1 -22 33\\r\\n1 -22 17\\r\\n2 30 -98\\r\\n2 -56 -48\\r\\n2 -84 -77\\r\\n2 49 56\\r\\n1 81 29\\r\\n1 26 29\\r\\n1 -14 20\\r\\n2 -37 83\\r\\n1 -91 96\\r\\n2 57 19\\r\\n1 94 54\\r\\n2 25 -30\\r\\n1 92 5\\r\\n2 -48 51\\r\\n2 81 23\\r\\n1 39 -47\\r\\n2 34 89\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '50\\r\\n1 7 -8\\r\\n1 -30 -28\\r\\n1 -8 2\\r\\n1 -28 -29\\r\\n2 -8 -21\\r\\n2 -23 19\\r\\n2 -23 18\\r\\n1 6 27\\r\\n2 -17 20\\r\\n1 9 -5\\r\\n2 -27 29\\r\\n1 -8 27\\r\\n2 13 12\\r\\n2 -29 13\\r\\n2 -30 8\\r\\n2 -30 -8\\r\\n1 -24 -21\\r\\n1 -14 -15\\r\\n2 -23 14\\r\\n2 -12 -13\\r\\n1 15 -24\\r\\n1 28 6\\r\\n2 -20 -21\\r\\n1 -8 -13\\r\\n1 -15 -15\\r\\n1 11 20\\r\\n2 24 -26\\r\\n1 -30 -11\\r\\n2 -17 18\\r\\n1 -17 6\\r\\n2 5 -9\\r\\n2 -29 8\\r\\n2 -29 1\\r\\n2 10 24\\r\\n2 29 27\\r\\n2 -12 21\\r\\n2 5 -28\\r\\n2 28 27\\r\\n2 -4 -4\\r\\n1 -24 29\\r\\n1 17 -1\\r\\n1 0 17\\r\\n1 -2 -1\\r\\n2 -7 -10\\r\\n1 5 -16\\r\\n2 -3 -26\\r\\n2 -7 17\\r\\n1 -27 -26\\r\\n1 -3 -30\\r\\n2 28 -15\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '10\\r\\n1 0 0\\r\\n1 6 0\\r\\n1 0 6\\r\\n2 0 0\\r\\n2 6 0\\r\\n2 0 6\\r\\n2 3 3\\r\\n2 3 0\\r\\n2 0 3\\r\\n2 2 2\\r\\n', 'output': ['YES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '50\\r\\n1 33 -21\\r\\n1 9 82\\r\\n1 -69 -54\\r\\n2 -3 84\\r\\n1 -9 -28\\r\\n2 -54 87\\r\\n2 26 -64\\r\\n2 8 52\\r\\n2 98 63\\r\\n2 -77 10\\r\\n2 -52 -46\\r\\n1 92 42\\r\\n2 -53 -69\\r\\n2 -48 44\\r\\n1 -52 90\\r\\n2 56 29\\r\\n2 -100 -13\\r\\n2 -23 1\\r\\n2 6 91\\r\\n2 53 -38\\r\\n1 48 -35\\r\\n2 19 -62\\r\\n2 -62 49\\r\\n1 59 78\\r\\n2 85 72\\r\\n2 28 76\\r\\n2 46 -91\\r\\n2 6 32\\r\\n2 -16 -59\\r\\n1 40 -53\\r\\n2 -6 87\\r\\n2 -79 -58\\r\\n2 -12 25\\r\\n2 73 49\\r\\n1 57 -42\\r\\n2 12 19\\r\\n1 -60 -5\\r\\n1 -40 -20\\r\\n1 90 35\\r\\n2 10 3\\r\\n2 63 -49\\r\\n1 50 10\\r\\n1 0 77\\r\\n1 92 24\\r\\n1 71 -7\\r\\n2 46 22\\r\\n1 19 81\\r\\n1 -3 -71\\r\\n2 -44 56\\r\\n2 92 34\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 3 3\\r\\n1 3 1\\r\\n1 0 1\\r\\n2 3 0\\r\\n2 6 5\\r\\n2 1 5\\r\\n2 8 3\\r\\n2 0 5\\r\\n2 3 4\\r\\n1 7 6\\r\\n1 1 0\\r\\n1 0 8\\r\\n1 3 7\\r\\n2 4 5\\r\\n2 2 5\\r\\n2 2 0\\r\\n1 7 4\\r\\n2 7 3\\r\\n1 5 0\\r\\n1 4 6\\r\\n1 1 5\\r\\n1 7 8\\r\\n2 7 5\\r\\n1 0 4\\r\\n2 3 8\\r\\n1 1 8\\r\\n1 0 5\\r\\n1 4 8\\r\\n2 8 5\\r\\n1 8 5\\r\\n2 3 6\\r\\n1 8 7\\r\\n2 4 3\\r\\n1 5 2\\r\\n2 2 8\\r\\n2 5 3\\r\\n2 4 0\\r\\n1 4 4\\r\\n1 6 5\\r\\n2 2 7\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}]","id":60} {"description":"You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.You have to color this array in $$$k$$$ colors in such a way that: Each element of the array should be colored in some color; For each $$$i$$$ from $$$1$$$ to $$$k$$$ there should be at least one element colored in the $$$i$$$-th color in the array; For each $$$i$$$ from $$$1$$$ to $$$k$$$ all elements colored in the $$$i$$$-th color should be distinct. Obviously, such coloring might be impossible. In this case, print \"NO\". Otherwise print \"YES\" and any coloring (i.e. numbers $$$c_1, c_2, \\dots c_n$$$, where $$$1 \\le c_i \\le k$$$ and $$$c_i$$$ is the color of the $$$i$$$-th element of the given array) satisfying the conditions above. If there are multiple answers, you can print any.","input_specification":"The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le k \\le n \\le 5000$$$) \u2014 the length of the array $$$a$$$ and the number of colors, respectively. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 5000$$$) \u2014 elements of the array $$$a$$$.","output_specification":"If there is no answer, print \"NO\". Otherwise print \"YES\" and any coloring (i.e. numbers $$$c_1, c_2, \\dots c_n$$$, where $$$1 \\le c_i \\le k$$$ and $$$c_i$$$ is the color of the $$$i$$$-th element of the given array) satisfying the conditions described in the problem statement. If there are multiple answers, you can print any.","notes":"NoteIn the first example the answer $$$2~ 1~ 2~ 1$$$ is also acceptable.In the second example the answer $$$1~ 1~ 1~ 2~ 2$$$ is also acceptable.There exist other acceptable answers for both examples.","sample_inputs":["4 2\n1 2 2 3","5 2\n3 2 1 2 3","5 2\n2 1 1 2 1"],"sample_outputs":["YES\n1 1 2 2","YES\n2 1 1 2 1","NO"],"src_uid":"3d4df21eebf32ce15841179bb85e6f2f","lang_cluster":"Java","difficulty":1400,"human_solution":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author caoash\n *\/\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastScanner in = new FastScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n BArrayKColoring solver = new BArrayKColoring();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class BArrayKColoring {\n public void solve(int testNumber, FastScanner br, PrintWriter pw) {\n int n = br.nextInt();\n int k = br.nextInt();\n Pair[] data = new Pair[n];\n for (int i = 0; i < data.length; i++) {\n data[i] = new Pair(br.nextInt(), i);\n }\n Arrays.sort(data);\n int[] fin = new int[n];\n int curr = 1;\n for (int i = 0; i < n; i++) {\n fin[i] = curr++;\n if (curr == k + 1) {\n curr = 1;\n }\n }\n int[] ret = new int[n];\n boolean[][] used = new boolean[5001][5001];\n for (int i = 0; i < n; i++) {\n ret[data[i].s] = fin[i];\n }\n\/\/ for(int i = 0; i < n; i++){\n\/\/ pw.print(ret[i] + \" \");\n\/\/ }\n\/\/ pw.println();\n for (int i = 0; i < n; i++) {\n if (used[data[i].f][fin[i]]) {\n pw.println(\"NO\");\n pw.close();\n return;\n } else {\n used[data[i].f][fin[i]] = true;\n }\n }\n pw.println(\"YES\");\n for (int i = 0; i < n; i++) {\n pw.print(ret[i] + \" \");\n }\n pw.close();\n }\n\n }\n\n static class Pair implements Comparable {\n public int f;\n public int s;\n\n public Pair(int f, int s) {\n this.f = f;\n this.s = s;\n }\n\n public int compareTo(Pair p) {\n return this.f == p.f ? this.s - p.s : this.f - p.f;\n }\n\n public String toString() {\n return \"(\" + f + \",\" + s + \")\";\n }\n\n }\n\n static class FastScanner {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private FastScanner.SpaceCharFilter filter;\n\n public FastScanner(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n}\n\n","testcases":"[{'input': '4 2\\r\\n1 2 2 3\\r\\n', 'output': ['YES\\r\\n1 2 1 2 \\r\\n']}, {'input': '5 2\\r\\n3 2 1 2 3\\r\\n', 'output': ['YES\\r\\n2 2 1 1 1 \\r\\n']}, {'input': '5 2\\r\\n2 1 1 2 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 4\\r\\n1 1 1 2 2\\r\\n', 'output': ['YES\\r\\n1 2 3 4 1 \\r\\n']}, {'input': '11 9\\r\\n1 1 2 2 2 2 2 2 3 4 5\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 8 9 1 2 \\r\\n']}, {'input': '4 4\\r\\n1 2 2 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 \\r\\n']}, {'input': '5 5\\r\\n1 1 2 1 1\\r\\n', 'output': ['YES\\r\\n1 2 5 3 4 \\r\\n']}, {'input': '4 4\\r\\n1 1 2 2\\r\\n', 'output': ['YES\\r\\n1 2 3 4 \\r\\n']}, {'input': '5 4\\r\\n1 2 1 2 3\\r\\n', 'output': ['YES\\r\\n1 3 2 4 1 \\r\\n']}, {'input': '5 5\\r\\n1 1 2 1 3\\r\\n', 'output': ['YES\\r\\n1 2 4 3 5 \\r\\n']}, {'input': '10 10\\r\\n1 2 3 1 2 3 4 5 6 7\\r\\n', 'output': ['YES\\r\\n1 3 5 2 4 6 7 8 9 10 \\r\\n']}, {'input': '8 6\\r\\n1 2 3 3 2 2 3 1\\r\\n', 'output': ['YES\\r\\n1 3 6 1 4 5 2 2 \\r\\n']}, {'input': '6 4\\r\\n1 1 2 2 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 1 2 \\r\\n']}, {'input': '5 5\\r\\n1 1 2 2 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 \\r\\n']}, {'input': '4 3\\r\\n2 2 1 1\\r\\n', 'output': ['YES\\r\\n3 1 1 2 \\r\\n']}, {'input': '10 10\\r\\n1 1 2 2 3 3 4 4 5 5\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 8 9 10 \\r\\n']}, {'input': '6 5\\r\\n1 1 2 2 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 1 \\r\\n']}, {'input': '4 4\\r\\n3 3 3 5\\r\\n', 'output': ['YES\\r\\n1 2 3 4 \\r\\n']}, {'input': '9 8\\r\\n1 2 2 3 3 3 4 5 4\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 1 8 \\r\\n']}, {'input': '5 5\\r\\n2 1 1 2 1\\r\\n', 'output': ['YES\\r\\n4 1 2 5 3 \\r\\n']}, {'input': '6 6\\r\\n1 1 2 1 2 2\\r\\n', 'output': ['YES\\r\\n1 2 4 3 5 6 \\r\\n']}, {'input': '6 6\\r\\n1 1 1 2 2 2\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 \\r\\n']}, {'input': '8 8\\r\\n1 1 1 1 1 2 2 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 8 \\r\\n']}, {'input': '6 6\\r\\n2 1 1 2 1 3\\r\\n', 'output': ['YES\\r\\n4 1 2 5 3 6 \\r\\n']}, {'input': '5 3\\r\\n3 2 1 2 3\\r\\n', 'output': ['YES\\r\\n1 2 1 3 2 \\r\\n']}, {'input': '6 6\\r\\n1 2 3 3 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 \\r\\n']}, {'input': '1 1\\r\\n5000\\r\\n', 'output': ['YES\\r\\n1 \\r\\n']}, {'input': '3 3\\r\\n6 7 8\\r\\n', 'output': ['YES\\r\\n1 2 3 \\r\\n']}, {'input': '8 6\\r\\n1 1 2 2 3 4 5 6\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 1 2 \\r\\n']}, {'input': '7 5\\r\\n2 3 2 1 1 1 3\\r\\n', 'output': ['YES\\r\\n4 1 5 1 2 3 2 \\r\\n']}, {'input': '5 4\\r\\n1 2 1 2 4\\r\\n', 'output': ['YES\\r\\n1 3 2 4 1 \\r\\n']}, {'input': '8 8\\r\\n1 2 2 2 1 1 3 3\\r\\n', 'output': ['YES\\r\\n1 4 5 6 2 3 7 8 \\r\\n']}, {'input': '3 2\\r\\n5000 5000 5000\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7 6\\r\\n1 2 3 4 2 3 4\\r\\n', 'output': ['YES\\r\\n1 2 4 6 3 5 1 \\r\\n']}, {'input': '2 1\\r\\n5000 5000\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 4\\r\\n3 2 1 2 3\\r\\n', 'output': ['YES\\r\\n4 2 1 3 1 \\r\\n']}, {'input': '4 4\\r\\n2 1 2 3\\r\\n', 'output': ['YES\\r\\n2 1 3 4 \\r\\n']}, {'input': '4 4\\r\\n2 1 3 2\\r\\n', 'output': ['YES\\r\\n2 1 4 3 \\r\\n']}, {'input': '6 6\\r\\n1 2 2 2 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 \\r\\n']}, {'input': '7 6\\r\\n1 2 3 7 7 7 7\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 1 \\r\\n']}, {'input': '1 1\\r\\n500\\r\\n', 'output': ['YES\\r\\n1 \\r\\n']}, {'input': '8 8\\r\\n2 1 1 1 1 1 1 1\\r\\n', 'output': ['YES\\r\\n8 1 2 3 4 5 6 7 \\r\\n']}, {'input': '6 6\\r\\n1 1 2 2 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 \\r\\n']}, {'input': '10 9\\r\\n1 2 1 1 1 1 1 1 2 1\\r\\n', 'output': ['YES\\r\\n1 9 2 3 4 5 6 7 1 8 \\r\\n']}, {'input': '8 8\\r\\n1 2 8 2 3 3 3 3\\r\\n', 'output': ['YES\\r\\n1 2 8 3 4 5 6 7 \\r\\n']}, {'input': '9 9\\r\\n1 2 2 3 2 5 3 6 8\\r\\n', 'output': ['YES\\r\\n1 2 3 5 4 7 6 8 9 \\r\\n']}, {'input': '4 4\\r\\n1 2 1 2\\r\\n', 'output': ['YES\\r\\n1 3 2 4 \\r\\n']}, {'input': '4 2\\r\\n2000 2000 2000 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 5\\r\\n1 2 1 2 4\\r\\n', 'output': ['YES\\r\\n1 3 2 4 5 \\r\\n']}, {'input': '8 8\\r\\n1 2 2 2 1 1 1 1\\r\\n', 'output': ['YES\\r\\n1 6 7 8 2 3 4 5 \\r\\n']}, {'input': '5 5\\r\\n3 2 1 2 3\\r\\n', 'output': ['YES\\r\\n4 2 1 3 5 \\r\\n']}, {'input': '9 9\\r\\n1 1 1 1 2 2 2 2 2\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 8 9 \\r\\n']}, {'input': '6 6\\r\\n1 1 1 1 2 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 \\r\\n']}, {'input': '5 5\\r\\n1 2 2 1 1\\r\\n', 'output': ['YES\\r\\n1 4 5 2 3 \\r\\n']}, {'input': '50 20\\r\\n1 1 1 1 1 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 \\r\\n']}, {'input': '5 5\\r\\n1 2 3 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 \\r\\n']}, {'input': '5 5\\r\\n1 1 1 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 \\r\\n']}, {'input': '7 3\\r\\n1 2 3 4 5 5 1\\r\\n', 'output': ['YES\\r\\n1 3 1 2 3 1 2 \\r\\n']}, {'input': '2 1\\r\\n7 9\\r\\n', 'output': ['YES\\r\\n1 1 \\r\\n']}, {'input': '4 2\\r\\n4999 4999 4999 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 5\\r\\n1 1 3 3 3\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 \\r\\n']}, {'input': '3 3\\r\\n1 1 2\\r\\n', 'output': ['YES\\r\\n1 2 3 \\r\\n']}, {'input': '5 5\\r\\n2 2 1 1 2\\r\\n', 'output': ['YES\\r\\n3 4 1 2 5 \\r\\n']}, {'input': '6 5\\r\\n1 2 3 4 4 4\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 1 \\r\\n']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['YES\\r\\n1 \\r\\n']}, {'input': '6 6\\r\\n1 2 1 2 4 5\\r\\n', 'output': ['YES\\r\\n1 3 2 4 5 6 \\r\\n']}, {'input': '8 6\\r\\n1 2 3 4 1 2 3 4\\r\\n', 'output': ['YES\\r\\n1 3 5 1 2 4 6 2 \\r\\n']}, {'input': '6 5\\r\\n1 2 1 2 1 2\\r\\n', 'output': ['YES\\r\\n1 4 2 5 3 1 \\r\\n']}, {'input': '10 10\\r\\n1 2 3 1 2 3 1 2 4 5\\r\\n', 'output': ['YES\\r\\n1 4 7 2 5 8 3 6 9 10 \\r\\n']}, {'input': '8 5\\r\\n9 3 9 6 10 7 8 2\\r\\n', 'output': ['YES\\r\\n1 2 2 3 3 4 5 1 \\r\\n']}, {'input': '18 18\\r\\n10 9 8 7 5 3 6 2 2 9 7 8 2 9 2 8 10 7\\r\\n', 'output': ['YES\\r\\n17 14 11 8 6 5 7 1 2 15 9 12 3 16 4 13 18 10 \\r\\n']}, {'input': '5 1\\r\\n5 2 3 4 5\\r\\n', 'output': ['NO\\r\\n']}, {'input': '9 9\\r\\n9 8 1 3 4 5 3 8 9\\r\\n', 'output': ['YES\\r\\n8 6 1 2 4 5 3 7 9 \\r\\n']}, {'input': '10 10\\r\\n1 2 3 3 2 1 4 5 7 10\\r\\n', 'output': ['YES\\r\\n1 3 5 6 4 2 7 8 9 10 \\r\\n']}, {'input': '10 10\\r\\n1 2 3 3 2 1 4 5 6 10\\r\\n', 'output': ['YES\\r\\n1 3 5 6 4 2 7 8 9 10 \\r\\n']}, {'input': '3 2\\r\\n500 500 500\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 5\\r\\n1 2 3 1 2\\r\\n', 'output': ['YES\\r\\n1 3 5 2 4 \\r\\n']}, {'input': '10 5\\r\\n1 2 3 4 1 2 3 4 1 2\\r\\n', 'output': ['YES\\r\\n1 4 2 4 2 5 3 5 3 1 \\r\\n']}, {'input': '10 7\\r\\n1 2 3 1 2 3 1 2 3 1\\r\\n', 'output': ['YES\\r\\n1 5 1 2 6 2 3 7 3 4 \\r\\n']}, {'input': '3 3\\r\\n1 2 2\\r\\n', 'output': ['YES\\r\\n1 2 3 \\r\\n']}, {'input': '4 4\\r\\n4999 5000 5000 4999\\r\\n', 'output': ['YES\\r\\n1 3 4 2 \\r\\n']}, {'input': '12 12\\r\\n8 8 8 8 8 8 4 4 4 4 2 2\\r\\n', 'output': ['YES\\r\\n7 8 9 10 11 12 3 4 5 6 1 2 \\r\\n']}, {'input': '5 4\\r\\n25 2 3 2 2\\r\\n', 'output': ['YES\\r\\n1 1 4 2 3 \\r\\n']}, {'input': '7 6\\r\\n1 1 1 1 1 2 2\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 1 \\r\\n']}, {'input': '3 3\\r\\n5 5 5\\r\\n', 'output': ['YES\\r\\n1 2 3 \\r\\n']}, {'input': '1 1\\r\\n2\\r\\n', 'output': ['YES\\r\\n1 \\r\\n']}, {'input': '6 2\\r\\n100 100 101 101 102 102\\r\\n', 'output': ['YES\\r\\n1 2 1 2 1 2 \\r\\n']}, {'input': '8 8\\r\\n1 1 2 2 3 3 4 4\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 8 \\r\\n']}, {'input': '3 1\\r\\n2 2 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 5\\r\\n1 1 2 2 1\\r\\n', 'output': ['YES\\r\\n1 2 4 5 3 \\r\\n']}, {'input': '8 6\\r\\n1 1 1 1 2 2 2 2\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 1 2 \\r\\n']}, {'input': '3 2\\r\\n2019 2019 2019\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 2\\r\\n2018 2018 2018\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10 10\\r\\n1 2 3 1 2 3 4 5 6 42\\r\\n', 'output': ['YES\\r\\n1 3 5 2 4 6 7 8 9 10 \\r\\n']}, {'input': '7 7\\r\\n1 1 1 1 2 3 4\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 7 \\r\\n']}, {'input': '10 10\\r\\n2017 2018 2019 2017 2018 2019 2020 2021 2022 2023\\r\\n', 'output': ['YES\\r\\n1 3 5 2 4 6 7 8 9 10 \\r\\n']}, {'input': '5 4\\r\\n1 4 6 6 3\\r\\n', 'output': ['YES\\r\\n1 3 4 1 2 \\r\\n']}, {'input': '4 4\\r\\n1 2 2 1\\r\\n', 'output': ['YES\\r\\n1 3 4 2 \\r\\n']}, {'input': '6 6\\r\\n1 1 2 2 3 4\\r\\n', 'output': ['YES\\r\\n1 2 3 4 5 6 \\r\\n']}, {'input': '6 3\\r\\n2 1 3 4 5 1\\r\\n', 'output': ['YES\\r\\n3 1 1 2 3 2 \\r\\n']}]","id":61} {"description":"The only difference between easy and hard versions is constraints.The BerTV channel every day broadcasts one episode of one of the $$$k$$$ TV shows. You know the schedule for the next $$$n$$$ days: a sequence of integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le k$$$), where $$$a_i$$$ is the show, the episode of which will be shown in $$$i$$$-th day.The subscription to the show is bought for the entire show (i.e. for all its episodes), for each show the subscription is bought separately.How many minimum subscriptions do you need to buy in order to have the opportunity to watch episodes of purchased shows $$$d$$$ ($$$1 \\le d \\le n$$$) days in a row? In other words, you want to buy the minimum number of TV shows so that there is some segment of $$$d$$$ consecutive days in which all episodes belong to the purchased shows.","input_specification":"The first line contains an integer $$$t$$$ ($$$1 \\le t \\le 100$$$) \u2014 the number of test cases in the input. Then $$$t$$$ test case descriptions follow. The first line of each test case contains three integers $$$n, k$$$ and $$$d$$$ ($$$1 \\le n \\le 100$$$, $$$1 \\le k \\le 100$$$, $$$1 \\le d \\le n$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le k$$$), where $$$a_i$$$ is the show that is broadcasted on the $$$i$$$-th day. It is guaranteed that the sum of the values \u200b\u200bof $$$n$$$ for all test cases in the input does not exceed $$$100$$$.","output_specification":"Print $$$t$$$ integers \u2014 the answers to the test cases in the input in the order they follow. The answer to a test case is the minimum number of TV shows for which you need to purchase a subscription so that you can watch episodes of the purchased TV shows on BerTV for $$$d$$$ consecutive days. Please note that it is permissible that you will be able to watch more than $$$d$$$ days in a row.","notes":"NoteIn the first test case to have an opportunity to watch shows for two consecutive days, you need to buy a subscription on show $$$1$$$ and on show $$$2$$$. So the answer is two.In the second test case, you can buy a subscription to any show because for each show you can find a segment of three consecutive days, consisting only of episodes of this show.In the third test case in the unique segment of four days, you have four different shows, so you need to buy a subscription to all these four shows.In the fourth test case, you can buy subscriptions to shows $$$3,5,7,8,9$$$, and you will be able to watch shows for the last eight days.","sample_inputs":["4\n5 2 2\n1 2 1 2 1\n9 3 3\n3 3 3 2 2 2 1 1 1\n4 10 4\n10 8 6 4\n16 9 8\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3"],"sample_outputs":["2\n1\n4\n5"],"src_uid":"56da4ec7cd849c4330d188d8c9bd6094","lang_cluster":"Java","difficulty":1300,"human_solution":"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream), 32768);\n tokenizer = null;\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public char nextChar() {\n return next().charAt(0);\n }\n\n public float nextFloat() {\n return Float.parseFloat(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] intArray = new int[n];\n for (int i = 0; i < n; i++) {\n intArray[i] = nextInt();\n }\n return intArray;\n }\n }\n\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Task solver = new Task();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Task {\n\n public static int q, n, k, d;\n public static int[] N = new int[200005];\n public static int[] check = new int[1000005];\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int q = in.nextInt();\n while (q-- > 0) {\n n = in.nextInt();\n k = in.nextInt();\n d = in.nextInt();\n int count = 0;\n int mi = Integer.MAX_VALUE;\n for (int i = 0; i < d - 1; i++) {\n N[i] = in.nextInt() - 1;\n if (check[N[i]] == 0) {\n count++;\n }\n check[N[i]]++;\n }\n for (int i = d - 1; i < n; i++) {\n N[i] = in.nextInt() - 1;\n if (check[N[i]] == 0) {\n count++;\n }\n check[N[i]]++;\n if (count < mi) {\n mi = count;\n }\n if (check[N[i - d + 1]] == 1) {\n count--;\n }\n check[N[i - d + 1]]--;\n }\n out.println(mi);\n for (int i = n - d + 1; i < n; i++) {\n check[N[i]]--;\n }\n }\n }\n }\n}","testcases":"[{'input': '4\\r\\n5 2 2\\r\\n1 2 1 2 1\\r\\n9 3 3\\r\\n3 3 3 2 2 2 1 1 1\\r\\n4 10 4\\r\\n10 8 6 4\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n', 'output': ['2\\r\\n1\\r\\n4\\r\\n5', '2\\n1\\n4\\n5']}, {'input': '10000\\r\\n4 4 1\\r\\n4 3 3 1\\r\\n9 1 7\\r\\n1 1 1 1 1 1 1 1 1\\r\\n1 7 1\\r\\n4\\r\\n3 7 3\\r\\n7 1 2\\r\\n3 6 2\\r\\n4 5 6\\r\\n8 7 3\\r\\n6 3 5 7 3 6 4 3\\r\\n5 6 2\\r\\n2 3 6 3 4\\r\\n1 7 1\\r\\n5\\r\\n4 4 1\\r\\n3 1 3 1\\r\\n7 2 4\\r\\n2 1 1 1 1 2 1\\r\\n4 5 1\\r\\n1 5 4 1\\r\\n9 10 1\\r\\n7 4 4 4 6 3 7 10 7\\r\\n3 8 1\\r\\n6 4 3\\r\\n1 7 1\\r\\n4\\r\\n5 7 5\\r\\n7 5 3 5 5\\r\\n5 10 2\\r\\n5 10 9 10 1\\r\\n2 2 1\\r\\n2 2\\r\\n6 10 4\\r\\n4 10 5 1 7 2\\r\\n7 10 2\\r\\n8 5 7 3 2 2 4\\r\\n2 9 1\\r\\n8 3\\r\\n3 10 3\\r\\n1 2 9\\r\\n10 9 1\\r\\n7 2 4 3 4 1 5 8 8 7\\r\\n9 4 5\\r\\n2 2 3 2 4 4 1 1 2\\r\\n6 9 2\\r\\n6 2 3 1 9 9\\r\\n5 8 1\\r\\n5 2 1 5 8\\r\\n9 5 3\\r\\n3 1 5 2 1 2 2 4 1\\r\\n6 10 1\\r\\n8 6 4 10 10 10\\r\\n...', 'output': ['1\\r\\n1\\r\\n1\\r\\n3\\r\\n2\\r\\n3\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n3\\r\\n2\\r\\n1\\r\\n4\\r\\n1\\r\\n1\\r\\n3\\r\\n1\\r\\n3\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n5\\r\\n1\\r\\n1\\r\\n3\\r\\n4\\r\\n1\\r\\n3\\r\\n3\\r\\n1\\r\\n2\\r\\n1\\r\\n2\\r\\n2\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n5\\r\\n4\\r\\n2\\r\\n1\\r\\n2\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n2\\r\\n1\\r\\n1\\r\\n2\\r\\n4\\r\\n2\\r\\n2\\r\\n3\\r\\n5\\r\\n2\\r\\n1\\r\\n5\\r\\n2\\r\\n1\\r\\n2\\r\\n1\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n3\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n4\\r\\n1\\r\\n1\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n3\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n2\\r\\n4\\r\\n1\\r\\n3\\r\\n3\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n3\\r\\n1\\r\\n2\\r\\n2\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n1\\r\\n4\\r\\n1\\r\\n1\\r\\n3\\r\\n3\\r\\n3\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n3\\r\\n4\\r\\n6\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n4\\r\\n1\\r\\n3\\r\\n1\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n2...']}, {'input': '10000\\r\\n25 2 1\\r\\n1 2 2 1 2 2 2 2 2 2 2 1 1 1 2 2 2 1 2 2 1 1 1 2 1\\r\\n24 27 19\\r\\n19 2 15 17 4 8 20 13 1 2 19 2 6 9 22 16 17 20 23 25 26 8 6 24\\r\\n4 10 1\\r\\n10 7 7 9\\r\\n11 15 1\\r\\n2 2 6 3 3 5 11 15 8 12 3\\r\\n19 20 3\\r\\n10 8 8 9 8 6 1 8 20 10 9 18 20 16 4 12 9 10 2\\r\\n22 8 11\\r\\n5 3 5 1 7 7 2 4 6 4 5 8 6 1 3 7 2 7 2 5 7 6\\r\\n16 4 6\\r\\n1 1 4 3 2 1 2 1 3 3 2 3 3 3 3 2\\r\\n19 25 5\\r\\n14 18 2 11 14 12 15 16 21 11 16 12 17 7 18 23 2 3 4\\r\\n26 16 1\\r\\n2 14 12 14 5 6 5 6 15 11 9 7 15 3 3 4 8 13 1 4 4 8 3 1 12 9\\r\\n19 13 9\\r\\n11 2 3 13 6 8 7 2 6 3 9 7 1...', 'output': ['1\\r\\n14\\r\\n1\\r\\n1\\r\\n2\\r\\n7\\r\\n2\\r\\n4\\r\\n1\\r\\n6\\r\\n7\\r\\n2\\r\\n7\\r\\n9\\r\\n4\\r\\n3\\r\\n2\\r\\n8\\r\\n4\\r\\n6\\r\\n1\\r\\n4\\r\\n4\\r\\n4\\r\\n3\\r\\n3\\r\\n2\\r\\n5\\r\\n9\\r\\n1\\r\\n3\\r\\n3\\r\\n3\\r\\n1\\r\\n7\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n6\\r\\n1\\r\\n6\\r\\n1\\r\\n4\\r\\n2\\r\\n2\\r\\n5\\r\\n5\\r\\n5\\r\\n4\\r\\n5\\r\\n2\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n2\\r\\n6\\r\\n2\\r\\n1\\r\\n3\\r\\n8\\r\\n6\\r\\n2\\r\\n1\\r\\n4\\r\\n1\\r\\n17\\r\\n2\\r\\n11\\r\\n1\\r\\n8\\r\\n1\\r\\n4\\r\\n8\\r\\n5\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n4\\r\\n2\\r\\n10\\r\\n4\\r\\n1\\r\\n8\\r\\n5\\r\\n7\\r\\n1\\r\\n11\\r\\n1\\r\\n2\\r\\n2\\r\\n1\\r\\n11\\r\\n6\\r\\n1\\r\\n4\\r\\n6\\r\\n16\\r\\n1\\r\\n12\\r\\n8\\r\\n4\\r\\n5\\r\\n1\\r\\n2\\r\\n6\\r\\n12\\r\\n2\\r\\n3\\r\\n3\\r\\n2\\r\\n2\\r\\n1\\r\\n6\\r\\n4\\r\\n13\\r\\n2\\r\\n11\\r\\n3\\r\\n4\\r\\n13\\r\\n1\\r\\n7\\r\\n5\\r\\n5\\r\\n11\\r\\n4\\r\\n3\\r\\n6\\r\\n6\\r\\n2\\r\\n1\\r\\n1\\r\\n9\\r\\n4\\r\\n9\\r\\n9\\r\\n13\\r\\n2\\r\\n5\\r\\n1\\r\\n1\\r\\n14\\r\\n5\\r\\n1\\r\\n10\\r\\n2\\r\\n2\\r\\n6\\r\\n1\\r\\n4\\r\\n1\\r\\n1\\r\\n2\\r\\n7\\r\\n1\\r\\n3\\r\\n1\\r\\n6\\r\\n2\\r\\n2\\r\\n4\\r\\n...']}, {'input': '1\\r\\n200000 50000 100000\\r\\n43620 16520 24169 29319 35300 6092 8697 40998 15469 16541 45920 21696 48009 37549 35849 6966 45977 49376 47590 10302 36127 14270 35645 20850 15907 32338 30934 35216 32431 48365 11343 28651 42051 4611 3208 48408 8001 13308 3528 34450 48338 44549 214 35127 25599 21629 13920 49465 30152 33128 22087 20254 29457 18159 30113 18369 20976 35278 49478 42126 44353 31877 49348 4138 43970 17640 12092 38376 23575 4559 13202 45493 27767 29431 14560 2957 25933 37550 11475 36643 29624 38619 38461 3...', 'output': ['43168']}, {'input': '1\\r\\n200000 1 100000\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...', 'output': ['1']}, {'input': '1\\r\\n200000 10 100000\\r\\n1 9 2 9 4 1 9 4 2 6 4 10 5 2 9 6 4 3 7 5 10 2 6 7 5 8 7 2 4 1 1 1 3 3 7 10 2 6 4 5 4 10 10 2 6 2 1 4 8 3 1 2 5 8 3 4 10 8 7 5 9 5 5 5 8 4 1 10 8 7 6 9 7 7 5 7 9 4 8 10 1 5 9 5 7 7 6 9 5 4 3 5 7 10 5 6 3 2 10 3 2 10 3 10 5 3 5 4 10 10 2 9 3 3 6 2 3 6 5 1 9 1 5 6 6 9 1 9 8 3 9 7 1 3 2 7 6 5 5 8 3 10 5 1 4 9 3 4 1 9 8 2 8 5 2 6 6 3 10 7 1 2 9 3 3 7 6 9 7 2 9 9 1 8 8 2 5 2 4 8 1 8 7 3 6 5 3 10 4 2 10 9 5 5 8 6 9 1 1 8 9 2 7 7 1 10 8 10 6 5 5 2 10 10 8 3 8 9 3 7 1 2 8 6 5 6 9 4 6 1 3 4 6 3 ...', 'output': ['10']}, {'input': '1\\r\\n200000 100 20000\\r\\n56 54 36 40 73 78 52 47 66 20 77 100 36 93 23 31 59 97 74 29 58 88 27 97 37 81 15 20 89 75 8 61 52 78 1 26 86 7 63 46 21 74 39 72 38 77 68 82 97 84 79 96 65 47 42 45 70 66 28 58 81 34 81 14 52 73 75 74 87 65 82 63 56 86 56 99 32 24 18 20 60 25 97 77 28 49 53 7 35 21 10 74 34 95 30 5 4 77 69 49 81 2 5 50 32 72 50 9 7 44 15 80 70 45 39 69 12 5 61 84 33 10 88 32 94 91 24 22 49 88 99 38 30 30 1 96 27 60 4 84 89 3 21 70 21 39 69 11 28 7 17 39 71 30 19 33 91 93 26 45 6 86 61 57 80 91 5 28 64...', 'output': ['100']}, {'input': '1\\r\\n200000 999996 100000\\r\\n1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171 176 181 186 191 196 201 206 211 216 221 226 231 236 241 246 251 256 261 266 271 276 281 286 291 296 301 306 311 316 321 326 331 336 341 346 351 356 361 366 371 376 381 386 391 396 401 406 411 416 421 426 431 436 441 446 451 456 461 466 471 476 481 486 491 496 501 506 511 516 521 526 531 536 541 546 551 556 561 566 571 576 581 586 591 596 601 606 611 616 621 626 631 ...', 'output': ['100000']}, {'input': '1\\r\\n200000 1000000 200000\\r\\n1000000 999995 999990 999985 999980 999975 999970 999965 999960 999955 999950 999945 999940 999935 999930 999925 999920 999915 999910 999905 999900 999895 999890 999885 999880 999875 999870 999865 999860 999855 999850 999845 999840 999835 999830 999825 999820 999815 999810 999805 999800 999795 999790 999785 999780 999775 999770 999765 999760 999755 999750 999745 999740 999735 999730 999725 999720 999715 999710 999705 999700 999695 999690 999685 999680 999675 999670 999665 999660 9...', 'output': ['200000']}, {'input': '1\\r\\n200000 1000 100000\\r\\n620 192 107 955 564 521 642 381 695 916 549 124 253 339 472 162 131 282 959 678 207 154 876 995 734 39 412 999 815 355 18 165 430 993 27 603 666 794 993 261 70 259 289 24 684 893 292 512 941 852 393 42 314 25 25 970 671 168 914 583 666 819 637 194 512 972 681 283 401 767 709 892 607 366 529 164 211 563 726 197 72 746 537 94 150 347 365 281 320 276 734 646 118 894 974 967 68 260 563 746 985 119 431 778 249 428 511 158 692 99 125 553 877 954 302 832 611 137 181 895 51 860 150 916 284 6...', 'output': ['1000']}, {'input': '1\\r\\n200000 100000 100000\\r\\n8647 17914 36109 89778 78993 55133 74489 27482 57585 98271 77889 47476 26434 78910 72270 37433 77590 94218 26776 81236 7857 52297 75984 96580 13420 37206 57335 15966 38003 44862 95973 906 76808 94689 51811 80545 49598 60279 5137 72373 67166 84168 43937 97833 79109 97555 66522 57877 67492 14888 45878 78979 86655 76238 22212 32085 91951 14238 83686 38492 81248 57509 57652 11778 87283 25990 28664 96610 45117 5398 15632 33866 83494 31775 58512 71264 17548 46621 80189 6618 19549 76932 5...', 'output': ['62936']}, {'input': '1\\r\\n200000 1000000 200000\\r\\n470364 225896 287028 539970 507065 834358 221882 79921 952537 675938 918775 600012 658158 451805 585924 200704 727836 877423 589359 95563 175804 737263 148093 693378 834010 564940 1442 668171 699064 243399 367947 932004 332361 500470 581460 457946 747126 822659 687570 763411 734109 359915 138955 532165 905740 554112 955385 526332 377610 359080 408012 320280 805135 892507 484900 811596 483912 864488 223962 260705 468 390385 483192 247665 841481 651754 428156 822508 897711 270750 80...', 'output': ['181244']}, {'input': '1\\r\\n200000 1000000 20000\\r\\n533722 392695 889264 562461 855026 138921 815803 461194 257052 45665 831069 886688 652160 561837 516684 283787 634185 14587 677319 708000 762661 815073 509775 30098 637512 723030 819497 202814 848040 970165 882077 948960 348866 282945 296186 444252 966548 552732 274192 16694 895137 572174 815092 350234 717680 652165 545471 904085 37325 47183 763599 162009 423431 10401 212741 944445 276272 304020 763078 730235 106465 974498 982395 46321 795699 969837 135760 488480 863430 883321 2125...', 'output': ['19770']}, {'input': '1\\r\\n200000 1 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['1']}, {'input': '1\\r\\n200000 1000000 1\\r\\n780737 872203 852770 369033 859738 846341 851594 954282 684383 209632 798015 36250 376958 793324 203798 459743 621399 649416 45468 297431 261695 620652 512718 793583 992894 200416 98975 368684 265169 695427 834486 116518 889256 354565 349037 240328 345769 475500 788435 452690 948139 738003 87787 656919 874748 293479 823979 451391 310748 446952 936638 761542 417856 248622 69762 416315 588495 748898 540043 217410 102504 122304 887006 865619 229595 6236 653431 864185 887339 426521 687555 ...', 'output': ['1']}, {'input': '1\\r\\n200000 999996 1\\r\\n1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171 176 181 186 191 196 201 206 211 216 221 226 231 236 241 246 251 256 261 266 271 276 281 286 291 296 301 306 311 316 321 326 331 336 341 346 351 356 361 366 371 376 381 386 391 396 401 406 411 416 421 426 431 436 441 446 451 456 461 466 471 476 481 486 491 496 501 506 511 516 521 526 531 536 541 546 551 556 561 566 571 576 581 586 591 596 601 606 611 616 621 626 631 636 6...', 'output': ['1']}, {'input': '1\\r\\n200000 999996 199999\\r\\n1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146 151 156 161 166 171 176 181 186 191 196 201 206 211 216 221 226 231 236 241 246 251 256 261 266 271 276 281 286 291 296 301 306 311 316 321 326 331 336 341 346 351 356 361 366 371 376 381 386 391 396 401 406 411 416 421 426 431 436 441 446 451 456 461 466 471 476 481 486 491 496 501 506 511 516 521 526 531 536 541 546 551 556 561 566 571 576 581 586 591 596 601 606 611 616 621 626 631 ...', 'output': ['199999']}, {'input': '10000\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 1000000 1\\r\\n1\\r\\n1 100000...', 'output': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1...']}, {'input': '10000\\r\\n20 1000000 5\\r\\n50000 100000 150000 200000 250000 300000 350000 400000 450000 500000 550000 600000 650000 700000 750000 800000 850000 900000 950000 1000000\\r\\n20 1000000 5\\r\\n50000 100000 150000 200000 250000 300000 350000 400000 450000 500000 550000 600000 650000 700000 750000 800000 850000 900000 950000 1000000\\r\\n20 1000000 5\\r\\n50000 100000 150000 200000 250000 300000 350000 400000 450000 500000 550000 600000 650000 700000 750000 800000 850000 900000 950000 1000000\\r\\n20 1000000 5\\r\\n50000 100000 150000 20000...', 'output': ['5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5...']}, {'input': '10000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000\\r\\n1 1000000 1\\r\\n1000000...', 'output': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1...']}, {'input': '10000\\r\\n20 1000000 6\\r\\n42 18468 6335 26501 19170 15725 11479 29359 26963 24465 5706 28146 23282 16828 9962 492 2996 11943 4828 5437\\r\\n20 1000000 6\\r\\n32392 14605 3903 154 293 12383 17422 18717 19719 19896 5448 21727 14772 11539 1870 19913 25668 26300 17036 9895\\r\\n20 1000000 6\\r\\n28704 23812 31323 30334 17674 4665 15142 7712 28254 6869 25548 27645 32663 32758 20038 12860 8724 9742 27530 779\\r\\n20 1000000 6\\r\\n12317 3036 22191 1843 289 30107 9041 8943 19265 22649 27447 23806 15891 6730 24371 15351 15007 31102 24394 3549...', 'output': ['6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6\\r\\n6...']}, {'input': '10000\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\\r\\n16 9 8\\r\\n3 1 ...', 'output': ['5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5\\r\\n5...']}, {'input': '1\\r\\n6969 100 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['1']}, {'input': '10000\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n1 1000000 1\\r\\n777\\r\\n...', 'output': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1...']}, {'input': '30\\r\\n4 4 1\\r\\n3 3 1 2\\r\\n4 4 1\\r\\n4 1 4 1\\r\\n1 1 1\\r\\n1\\r\\n3 2 1\\r\\n2 1 2\\r\\n4 4 2\\r\\n3 2 2 2\\r\\n4 2 4\\r\\n1 2 2 2\\r\\n1 4 1\\r\\n4\\r\\n2 3 1\\r\\n2 3\\r\\n2 2 1\\r\\n2 2\\r\\n4 4 2\\r\\n1 2 4 2\\r\\n4 4 1\\r\\n2 4 4 3\\r\\n4 3 1\\r\\n1 3 1 3\\r\\n1 1 1\\r\\n1\\r\\n2 2 2\\r\\n2 1\\r\\n2 4 1\\r\\n1 4\\r\\n2 4 1\\r\\n3 4\\r\\n1 2 1\\r\\n1\\r\\n2 4 2\\r\\n2 1\\r\\n3 1 2\\r\\n1 1 1\\r\\n2 4 1\\r\\n1 4\\r\\n2 3 1\\r\\n3 3\\r\\n4 2 2\\r\\n2 1 2 2\\r\\n3 2 2\\r\\n2 2 1\\r\\n4 3 1\\r\\n2 2 1 2\\r\\n2 3 1\\r\\n1 3\\r\\n4 4 4\\r\\n3 2 2 3\\r\\n1 4 1\\r\\n1\\r\\n2 1 2\\r\\n1 1\\r\\n1 4 1\\r\\n4\\r\\n2 3 1\\r\\n3 3\\r\\n', 'output': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n1', '1\\n1\\n1\\n1\\n1\\n2\\n1\\n1\\n1\\n2\\n1\\n1\\n1\\n2\\n1\\n1\\n1\\n2\\n1\\n1\\n1\\n1\\n1\\n1\\n1\\n2\\n1\\n1\\n1\\n1']}, {'input': '15\\r\\n6 4 6\\r\\n2 3 2 3 4 2\\r\\n7 8 4\\r\\n5 6 2 7 7 3 3\\r\\n8 1 5\\r\\n1 1 1 1 1 1 1 1\\r\\n1 5 1\\r\\n1\\r\\n2 7 2\\r\\n6 7\\r\\n6 8 4\\r\\n8 5 4 1 6 6\\r\\n1 8 1\\r\\n2\\r\\n3 8 2\\r\\n2 3 3\\r\\n2 2 1\\r\\n1 1\\r\\n8 2 5\\r\\n2 2 1 1 1 1 1 1\\r\\n7 6 4\\r\\n2 4 1 1 2 4 3\\r\\n8 8 2\\r\\n6 5 6 1 3 1 2 8\\r\\n5 6 1\\r\\n6 1 2 6 2\\r\\n6 5 5\\r\\n1 5 2 4 4 5\\r\\n7 1 6\\r\\n1 1 1 1 1 1 1\\r\\n', 'output': ['3\\n2\\n1\\n1\\n2\\n3\\n1\\n1\\n1\\n1\\n3\\n2\\n1\\n3\\n1', '3\\r\\n2\\r\\n1\\r\\n1\\r\\n2\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n3\\r\\n2\\r\\n1\\r\\n3\\r\\n1']}, {'input': '10\\r\\n6 9 4\\r\\n8 8 2 5 8 9\\r\\n5 3 4\\r\\n1 3 1 2 1\\r\\n10 5 10\\r\\n3 2 4 2 1 1 2 2 3 4\\r\\n7 7 3\\r\\n4 6 2 6 4 5 2\\r\\n9 9 6\\r\\n4 6 7 2 5 5 7 4 8\\r\\n6 5 4\\r\\n2 3 2 5 5 5\\r\\n8 3 4\\r\\n2 3 2 3 2 1 1 3\\r\\n10 6 9\\r\\n6 2 4 1 4 5 5 2 1 1\\r\\n8 7 2\\r\\n4 4 5 6 2 5 3 4\\r\\n1 9 1\\r\\n3\\r\\n', 'output': ['3\\r\\n3\\r\\n4\\r\\n2\\r\\n4\\r\\n2\\r\\n2\\r\\n4\\r\\n1\\r\\n1', '3\\n3\\n4\\n2\\n4\\n2\\n2\\n4\\n1\\n1']}, {'input': '5\\r\\n17 10 1\\r\\n8 5 10 7 4 7 2 9 8 10 7 2 6 5 1 1 5\\r\\n22 13 5\\r\\n1 9 12 4 6 1 8 10 1 11 1 2 1 6 8 12 11 8 10 6 2 12\\r\\n13 25 7\\r\\n22 7 19 12 7 17 7 6 22 19 5 5 23\\r\\n1 6 1\\r\\n6\\r\\n1 15 1\\r\\n7\\r\\n', 'output': ['1\\n3\\n5\\n1\\n1', '1\\r\\n3\\r\\n5\\r\\n1\\r\\n1']}, {'input': '1\\r\\n100 90 100\\r\\n8 39 60 46 68 2 42 45 7 54 89 78 16 59 21 29 5 30 20 12 64 42 34 33 13 17 55 30 54 31 23 27 38 36 2 49 45 43 47 55 4 6 55 38 60 16 34 86 67 76 55 86 39 62 12 58 74 51 10 31 38 85 50 61 48 35 69 24 64 53 4 19 15 35 28 22 88 3 25 60 9 40 67 47 26 57 58 61 65 21 76 4 15 35 37 49 62 45 81 32\\r\\n', 'output': ['67']}, {'input': '1\\r\\n100 100 100\\r\\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['100']}, {'input': '1\\r\\n100 50 100\\r\\n22 28 34 29 43 8 12 12 4 29 36 38 22 5 19 38 4 41 20 33 39 11 2 40 42 8 33 23 20 47 45 30 47 33 27 23 50 26 30 43 8 3 4 38 46 32 20 19 10 3 18 29 21 19 37 30 12 38 27 44 24 39 25 18 50 44 37 22 39 41 18 26 37 40 40 16 38 9 12 36 27 31 45 47 31 31 29 48 25 7 29 24 10 2 8 3 36 48 8 9\\r\\n', 'output': ['42']}, {'input': '1\\r\\n100 1 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['1']}, {'input': '1\\r\\n100 10 100\\r\\n9 2 2 3 5 2 2 3 4 9 5 3 6 2 1 4 4 8 6 2 3 10 4 1 5 2 8 8 3 9 2 7 2 3 4 2 2 8 9 7 10 3 7 7 4 4 8 8 9 7 1 8 10 3 6 8 1 9 4 6 5 6 9 2 9 6 7 10 5 8 7 10 6 1 9 2 10 10 10 9 6 5 6 9 2 8 1 2 2 5 6 6 3 3 7 10 10 1 6 3\\r\\n', 'output': ['10']}, {'input': '1\\r\\n100 2 100\\r\\n2 1 2 2 1 2 2 1 1 2 2 2 2 2 1 1 1 1 2 1 1 1 2 2 2 1 1 1 2 1 1 1 1 2 1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 1 1 2 2 2 1 1 2 1 2 2 2 2 1 1 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 2 1 2 1 2 2 2 1 2\\r\\n', 'output': ['2']}, {'input': '1\\r\\n100 16 100\\r\\n1 11 2 2 13 8 3 15 8 11 13 1 16 16 3 5 12 10 11 16 1 14 16 8 14 3 15 8 2 8 10 1 16 14 8 4 2 10 3 8 3 5 8 10 4 12 11 8 8 15 16 5 7 6 3 9 15 7 1 14 14 2 13 4 10 6 12 13 9 8 9 2 9 3 2 12 9 3 8 11 14 9 3 3 15 10 12 10 10 16 2 12 13 7 6 7 13 1 14 15\\r\\n', 'output': ['16']}, {'input': '1\\r\\n100 100 50\\r\\n40 23 65 71 63 65 82 49 42 62 80 68 30 97 95 11 19 16 50 33 99 40 100 88 7 52 83 80 68 30 32 40 67 16 45 89 54 88 9 42 40 65 96 97 9 100 53 84 40 40 66 13 47 30 71 14 83 18 35 70 73 52 17 91 87 59 81 5 84 94 1 9 23 90 32 91 69 77 38 84 38 74 6 26 100 47 39 23 84 90 67 86 67 80 31 51 71 97 69 68\\r\\n', 'output': ['34']}, {'input': '1\\r\\n100 100 33\\r\\n78 92 82 75 58 98 94 39 38 88 89 78 2 95 53 47 74 95 14 92 49 44 8 67 31 77 90 20 16 92 19 32 26 75 81 4 79 46 21 44 5 19 64 72 13 9 74 58 84 62 70 86 77 4 39 97 1 67 98 99 89 34 29 13 24 2 69 68 30 66 77 16 26 49 1 25 89 26 28 25 96 55 51 44 10 7 36 75 12 81 31 46 52 55 48 78 82 95 39 44\\r\\n', 'output': ['28']}, {'input': '1\\r\\n100 1 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['1']}, {'input': '1\\r\\n100 20 1\\r\\n10 17 9 8 11 8 8 3 7 20 11 10 7 7 2 13 10 7 7 10 7 8 4 17 20 9 5 18 12 8 3 5 19 1 18 14 9 11 12 11 11 12 12 9 13 8 20 3 8 1 15 20 6 18 8 1 13 11 4 17 12 15 4 4 11 19 18 5 2 12 15 20 5 8 11 16 14 13 17 14 14 5 6 8 8 13 6 3 18 14 8 14 11 11 9 4 18 1 16 6\\r\\n', 'output': ['1']}, {'input': '1\\r\\n100 20 2\\r\\n18 1 3 1 13 1 3 15 3 2 7 14 1 8 1 10 1 1 9 18 11 6 9 12 17 5 6 7 13 14 9 4 6 14 7 14 19 6 13 10 7 2 17 3 10 11 11 7 2 4 9 12 11 6 20 20 4 16 7 10 8 4 19 18 2 4 6 5 20 2 12 6 20 20 18 7 11 20 10 2 8 5 16 4 19 17 18 9 7 9 13 10 3 12 18 2 6 12 18 10\\r\\n', 'output': ['1']}, {'input': '1\\r\\n100 100 1\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\\r\\n', 'output': ['1']}, {'input': '1\\r\\n100 100 2\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\\r\\n', 'output': ['2']}, {'input': '1\\r\\n100 100 10\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\\r\\n', 'output': ['10']}, {'input': '1\\r\\n100 100 99\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\\r\\n', 'output': ['99']}, {'input': '1\\r\\n100 100 100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\\r\\n', 'output': ['100']}, {'input': '1\\r\\n100 100 1\\r\\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['1']}, {'input': '1\\r\\n100 100 2\\r\\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['2']}, {'input': '1\\r\\n100 100 3\\r\\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['3']}, {'input': '1\\r\\n100 100 99\\r\\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['99']}]","id":62} {"description":"Dawid has four bags of candies. The $$$i$$$-th of them contains $$$a_i$$$ candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same amount of candies in total?Note, that you can't keep bags for yourself or throw them away, each bag should be given to one of the friends.","input_specification":"The only line contains four integers $$$a_1$$$, $$$a_2$$$, $$$a_3$$$ and $$$a_4$$$ ($$$1 \\leq a_i \\leq 100$$$) \u2014 the numbers of candies in each bag.","output_specification":"Output YES if it's possible to give the bags to Dawid's friends so that both friends receive the same amount of candies, or NO otherwise. Each character can be printed in any case (either uppercase or lowercase).","notes":"NoteIn the first sample test, Dawid can give the first and the third bag to the first friend, and the second and the fourth bag to the second friend. This way, each friend will receive $$$12$$$ candies.In the second sample test, it's impossible to distribute the bags.","sample_inputs":["1 7 11 5","7 3 2 5"],"sample_outputs":["YES","NO"],"src_uid":"5a623c49cf7effacfb58bc82f8eaff37","lang_cluster":"Java","difficulty":800,"human_solution":"import java.util.*;\nimport java.io.*;\npublic class Main\n{\n public static void main(String args[])throws IOException\n {\n BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));\n String temp[]=obj.readLine().split(\" \");\n int arr[]=new int[temp.length];\n long total=0;\n for(int i=0;i 0) \n sum+=arr[j]; \n }\n if(total==2*sum)\n return true;\n }\n return false;\n }\n}","testcases":"[{'input': '1 7 11 5\\r\\n', 'output': ['YES']}, {'input': '7 3 2 5\\r\\n', 'output': ['NO']}, {'input': '3 14 36 53\\r\\n', 'output': ['YES']}, {'input': '30 74 41 63\\r\\n', 'output': ['YES']}, {'input': '92 69 83 97\\r\\n', 'output': ['NO']}, {'input': '26 52 7 19\\r\\n', 'output': ['YES']}, {'input': '72 52 62 62\\r\\n', 'output': ['YES']}, {'input': '1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '70 100 10 86\\r\\n', 'output': ['NO']}, {'input': '14 10 18 24\\r\\n', 'output': ['NO']}, {'input': '20 14 37 71\\r\\n', 'output': ['YES']}, {'input': '1 1 2 1\\r\\n', 'output': ['NO']}, {'input': '2 4 1 1\\r\\n', 'output': ['YES']}, {'input': '34 11 84 39\\r\\n', 'output': ['YES']}, {'input': '76 97 99 74\\r\\n', 'output': ['YES']}, {'input': '44 58 90 53\\r\\n', 'output': ['NO']}, {'input': '18 88 18 18\\r\\n', 'output': ['NO']}, {'input': '48 14 3 31\\r\\n', 'output': ['YES']}, {'input': '72 96 2 26\\r\\n', 'output': ['YES']}, {'input': '69 7 44 30\\r\\n', 'output': ['NO']}, {'input': '66 68 16 82\\r\\n', 'output': ['NO']}, {'input': '100 100 100 100\\r\\n', 'output': ['YES']}, {'input': '100 98 99 97\\r\\n', 'output': ['YES']}, {'input': '1 100 100 1\\r\\n', 'output': ['YES']}, {'input': '100 100 99 100\\r\\n', 'output': ['NO']}, {'input': '99 100 3 98\\r\\n', 'output': ['NO']}, {'input': '4 4 4 5\\r\\n', 'output': ['NO']}, {'input': '2 6 3 2\\r\\n', 'output': ['NO']}, {'input': '7 3 6 3\\r\\n', 'output': ['NO']}, {'input': '14 9 10 6\\r\\n', 'output': ['NO']}, {'input': '2 4 6 6\\r\\n', 'output': ['NO']}, {'input': '4 2 4 2\\r\\n', 'output': ['YES']}, {'input': '4 4 4 8\\r\\n', 'output': ['NO']}, {'input': '6 4 8 6\\r\\n', 'output': ['YES']}, {'input': '97 95 91 27\\r\\n', 'output': ['NO']}, {'input': '1 2 3 2\\r\\n', 'output': ['YES']}, {'input': '1 2 8 9\\r\\n', 'output': ['YES']}, {'input': '5 10 1 6\\r\\n', 'output': ['YES']}, {'input': '1 2 3 5\\r\\n', 'output': ['NO']}, {'input': '3 5 1 3\\r\\n', 'output': ['YES']}, {'input': '1 2 3 3\\r\\n', 'output': ['NO']}, {'input': '1 1 14 12\\r\\n', 'output': ['YES']}, {'input': '1 1 1 2\\r\\n', 'output': ['NO']}, {'input': '6 3 6 6\\r\\n', 'output': ['NO']}, {'input': '10 2 3 5\\r\\n', 'output': ['YES']}, {'input': '1 2 10 7\\r\\n', 'output': ['YES']}, {'input': '3 1 1 1\\r\\n', 'output': ['YES']}, {'input': '1 2 5 5\\r\\n', 'output': ['NO']}, {'input': '2 3 10 10\\r\\n', 'output': ['NO']}, {'input': '2 2 4 6\\r\\n', 'output': ['NO']}, {'input': '1 1 10 20\\r\\n', 'output': ['NO']}, {'input': '1 1 3 1\\r\\n', 'output': ['YES']}, {'input': '1 2 1 3\\r\\n', 'output': ['NO']}, {'input': '18 17 17 20\\r\\n', 'output': ['NO']}, {'input': '3 2 1 1\\r\\n', 'output': ['NO']}, {'input': '1 1 4 5\\r\\n', 'output': ['NO']}, {'input': '90 30 30 30\\r\\n', 'output': ['YES']}, {'input': '1 2 6 3\\r\\n', 'output': ['YES']}, {'input': '2 3 3 4\\r\\n', 'output': ['YES']}, {'input': '1 1 4 2\\r\\n', 'output': ['YES']}, {'input': '1 1 2 3\\r\\n', 'output': ['NO']}, {'input': '1 1 3 4\\r\\n', 'output': ['NO']}, {'input': '2 1 28 9\\r\\n', 'output': ['NO']}, {'input': '1 2 3 4\\r\\n', 'output': ['YES']}, {'input': '1 2 4 5\\r\\n', 'output': ['YES']}, {'input': '2 2 6 2\\r\\n', 'output': ['YES']}, {'input': '2 3 2 5\\r\\n', 'output': ['NO']}, {'input': '5 7 1 3\\r\\n', 'output': ['YES']}, {'input': '4 4 12 4\\r\\n', 'output': ['YES']}, {'input': '1 2 2 7\\r\\n', 'output': ['NO']}]","id":63} {"description":"A string is a palindrome if it reads the same from the left to the right and from the right to the left. For example, the strings \"kek\", \"abacaba\", \"r\" and \"papicipap\" are palindromes, while the strings \"abb\" and \"iq\" are not.A substring $$$s[l \\ldots r]$$$ ($$$1\u2009\\leq\u2009l\u2009\\leq\u2009r\u2009\\leq\u2009|s|$$$) of a string $$$s\u2009=\u2009s_{1}s_{2} \\ldots s_{|s|}$$$ is the string $$$s_{l}s_{l\u2009+\u20091} \\ldots s_{r}$$$.Anna does not like palindromes, so she makes her friends call her Ann. She also changes all the words she reads in a similar way. Namely, each word $$$s$$$ is changed into its longest substring that is not a palindrome. If all the substrings of $$$s$$$ are palindromes, she skips the word at all.Some time ago Ann read the word $$$s$$$. What is the word she changed it into?","input_specification":"The first line contains a non-empty string $$$s$$$ with length at most $$$50$$$ characters, containing lowercase English letters only.","output_specification":"If there is such a substring in $$$s$$$ that is not a palindrome, print the maximum length of such a substring. Otherwise print $$$0$$$. Note that there can be multiple longest substrings that are not palindromes, but their length is unique.","notes":"Note\"mew\" is not a palindrome, so the longest substring of it that is not a palindrome, is the string \"mew\" itself. Thus, the answer for the first example is $$$3$$$.The string \"uffuw\" is one of the longest non-palindrome substrings (of length $$$5$$$) of the string \"wuffuw\", so the answer for the second example is $$$5$$$.All substrings of the string \"qqqqqqqq\" consist of equal characters so they are palindromes. This way, there are no non-palindrome substrings. Thus, the answer for the third example is $$$0$$$.","sample_inputs":["mew","wuffuw","qqqqqqqq"],"sample_outputs":["3","5","0"],"src_uid":"6c85175d334f811617e7030e0403f706","lang_cluster":"Java","difficulty":900,"human_solution":"import java.util.HashSet;\nimport java.util.Scanner;\n\npublic class Nafis {\n\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n String str = sc.next();\n int sz = str.length();\n HashSet freq = new HashSet<>();\n for (int i = 0; i <= sz \/ 2; i++) {\n if (str.charAt(i) == str.charAt(sz - i - 1)) {\n freq.add(str.charAt(i));\n continue;\n } else {\n System.out.println(sz);\n return;\n }\n }\n\n System.out.println(freq.size() == 1 ? 0 : sz - 1);\n\n }\n}","testcases":"[{'input': 'mew\\r\\n', 'output': ['3']}, {'input': 'wuffuw\\r\\n', 'output': ['5']}, {'input': 'qqqqqqqq\\r\\n', 'output': ['0']}, {'input': 'ijvji\\r\\n', 'output': ['4']}, {'input': 'iiiiiii\\r\\n', 'output': ['0']}, {'input': 'wobervhvvkihcuyjtmqhaaigvvgiaahqmtjyuchikvvhvrebow\\r\\n', 'output': ['49']}, {'input': 'wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\\r\\n', 'output': ['0']}, {'input': 'wobervhvvkihcuyjtmqhaaigvahheoqleromusrartldojsjvy\\r\\n', 'output': ['50']}, {'input': 'ijvxljt\\r\\n', 'output': ['7']}, {'input': 'fyhcncnchyf\\r\\n', 'output': ['10']}, {'input': 'ffffffffffff\\r\\n', 'output': ['0']}, {'input': 'fyhcncfsepqj\\r\\n', 'output': ['12']}, {'input': 'ybejrrlbcinttnicblrrjeby\\r\\n', 'output': ['23']}, {'input': 'yyyyyyyyyyyyyyyyyyyyyyyyy\\r\\n', 'output': ['0']}, {'input': 'ybejrrlbcintahovgjddrqatv\\r\\n', 'output': ['25']}, {'input': 'oftmhcmclgyqaojljoaqyglcmchmtfo\\r\\n', 'output': ['30']}, {'input': 'oooooooooooooooooooooooooooooooo\\r\\n', 'output': ['0']}, {'input': 'oftmhcmclgyqaojllbotztajglsmcilv\\r\\n', 'output': ['32']}, {'input': 'gxandbtgpbknxvnkjaajknvxnkbpgtbdnaxg\\r\\n', 'output': ['35']}, {'input': 'gggggggggggggggggggggggggggggggggggg\\r\\n', 'output': ['0']}, {'input': 'gxandbtgpbknxvnkjaygommzqitqzjfalfkk\\r\\n', 'output': ['36']}, {'input': 'fcliblymyqckxvieotjooojtoeivxkcqymylbilcf\\r\\n', 'output': ['40']}, {'input': 'fffffffffffffffffffffffffffffffffffffffffff\\r\\n', 'output': ['0']}, {'input': 'fcliblymyqckxvieotjootiqwtyznhhvuhbaixwqnsy\\r\\n', 'output': ['43']}, {'input': 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr\\r\\n', 'output': ['0']}, {'input': 'rajccqwqnqmshmerpvjyfepxwpxyldzpzhctqjnstxyfmlhiy\\r\\n', 'output': ['49']}, {'input': 'a\\r\\n', 'output': ['0']}, {'input': 'abca\\r\\n', 'output': ['4']}, {'input': 'aaaaabaaaaa\\r\\n', 'output': ['10']}, {'input': 'aba\\r\\n', 'output': ['2']}, {'input': 'asaa\\r\\n', 'output': ['4']}, {'input': 'aabaa\\r\\n', 'output': ['4']}, {'input': 'aabbaa\\r\\n', 'output': ['5']}, {'input': 'abcdaaa\\r\\n', 'output': ['7']}, {'input': 'aaholaa\\r\\n', 'output': ['7']}, {'input': 'abcdefghijka\\r\\n', 'output': ['12']}, {'input': 'aaadcba\\r\\n', 'output': ['7']}, {'input': 'aaaabaaaa\\r\\n', 'output': ['8']}, {'input': 'abaa\\r\\n', 'output': ['4']}, {'input': 'abcbaa\\r\\n', 'output': ['6']}, {'input': 'ab\\r\\n', 'output': ['2']}, {'input': 'l\\r\\n', 'output': ['0']}, {'input': 'aaaabcaaaa\\r\\n', 'output': ['10']}, {'input': 'abbaaaaaabba\\r\\n', 'output': ['11']}, {'input': 'abaaa\\r\\n', 'output': ['5']}, {'input': 'baa\\r\\n', 'output': ['3']}, {'input': 'aaaaaaabbba\\r\\n', 'output': ['11']}, {'input': 'ccbcc\\r\\n', 'output': ['4']}, {'input': 'bbbaaab\\r\\n', 'output': ['7']}, {'input': 'abaaaaaaaa\\r\\n', 'output': ['10']}, {'input': 'abaaba\\r\\n', 'output': ['5']}, {'input': 'aabsdfaaaa\\r\\n', 'output': ['10']}, {'input': 'aaaba\\r\\n', 'output': ['5']}, {'input': 'aaabaaa\\r\\n', 'output': ['6']}, {'input': 'baaabbb\\r\\n', 'output': ['7']}, {'input': 'ccbbabbcc\\r\\n', 'output': ['8']}, {'input': 'cabc\\r\\n', 'output': ['4']}, {'input': 'aabcd\\r\\n', 'output': ['5']}, {'input': 'abcdea\\r\\n', 'output': ['6']}, {'input': 'bbabb\\r\\n', 'output': ['4']}, {'input': 'aaaaabababaaaaa\\r\\n', 'output': ['14']}, {'input': 'bbabbb\\r\\n', 'output': ['6']}, {'input': 'aababd\\r\\n', 'output': ['6']}, {'input': 'abaaaa\\r\\n', 'output': ['6']}, {'input': 'aaaaaaaabbba\\r\\n', 'output': ['12']}, {'input': 'aabca\\r\\n', 'output': ['5']}, {'input': 'aaabccbaaa\\r\\n', 'output': ['9']}, {'input': 'aaaaaaaaaaaaaaaaaaaab\\r\\n', 'output': ['21']}, {'input': 'babb\\r\\n', 'output': ['4']}, {'input': 'abcaa\\r\\n', 'output': ['5']}, {'input': 'qwqq\\r\\n', 'output': ['4']}, {'input': 'aaaaaaaaaaabbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaa\\r\\n', 'output': ['48']}, {'input': 'aaab\\r\\n', 'output': ['4']}, {'input': 'aaaaaabaaaaa\\r\\n', 'output': ['12']}, {'input': 'wwuww\\r\\n', 'output': ['4']}, {'input': 'aaaaabcbaaaaa\\r\\n', 'output': ['12']}, {'input': 'aaabbbaaa\\r\\n', 'output': ['8']}, {'input': 'aabcbaa\\r\\n', 'output': ['6']}, {'input': 'abccdefccba\\r\\n', 'output': ['11']}, {'input': 'aabbcbbaa\\r\\n', 'output': ['8']}, {'input': 'aaaabbaaaa\\r\\n', 'output': ['9']}, {'input': 'aabcda\\r\\n', 'output': ['6']}, {'input': 'abbca\\r\\n', 'output': ['5']}, {'input': 'aaaaaabbaaa\\r\\n', 'output': ['11']}, {'input': 'sssssspssssss\\r\\n', 'output': ['12']}, {'input': 'sdnmsdcs\\r\\n', 'output': ['8']}, {'input': 'aaabbbccbbbaaa\\r\\n', 'output': ['13']}, {'input': 'cbdbdc\\r\\n', 'output': ['6']}, {'input': 'abb\\r\\n', 'output': ['3']}, {'input': 'abcdefaaaa\\r\\n', 'output': ['10']}, {'input': 'abbbaaa\\r\\n', 'output': ['7']}, {'input': 'v\\r\\n', 'output': ['0']}, {'input': 'abccbba\\r\\n', 'output': ['7']}, {'input': 'axyza\\r\\n', 'output': ['5']}, {'input': 'abcdefgaaaa\\r\\n', 'output': ['11']}, {'input': 'aaabcdaaa\\r\\n', 'output': ['9']}, {'input': 'aaaacaaaa\\r\\n', 'output': ['8']}, {'input': 'aaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaa\\r\\n', 'output': ['42']}, {'input': 'abbbaa\\r\\n', 'output': ['6']}, {'input': 'abcdee\\r\\n', 'output': ['6']}, {'input': 'oom\\r\\n', 'output': ['3']}, {'input': 'aabcaa\\r\\n', 'output': ['6']}, {'input': 'abba\\r\\n', 'output': ['3']}, {'input': 'aaca\\r\\n', 'output': ['4']}, {'input': 'aacbca\\r\\n', 'output': ['6']}, {'input': 'ababa\\r\\n', 'output': ['4']}, {'input': 'abcda\\r\\n', 'output': ['5']}, {'input': 'cccaaccc\\r\\n', 'output': ['7']}, {'input': 'aaabcda\\r\\n', 'output': ['7']}, {'input': 'aa\\r\\n', 'output': ['0']}, {'input': 'aabaaaa\\r\\n', 'output': ['7']}, {'input': 'abbaaaa\\r\\n', 'output': ['7']}, {'input': 'aaabcbaaa\\r\\n', 'output': ['8']}, {'input': 'aabba\\r\\n', 'output': ['5']}, {'input': 'xyxx\\r\\n', 'output': ['4']}, {'input': 'aaaaaaaaaaaabc\\r\\n', 'output': ['14']}, {'input': 'bbaaaabb\\r\\n', 'output': ['7']}, {'input': 'aaabaa\\r\\n', 'output': ['6']}, {'input': 'sssssabsssss\\r\\n', 'output': ['12']}, {'input': 'bbbaaaabbb\\r\\n', 'output': ['9']}, {'input': 'abbbbaaaa\\r\\n', 'output': ['9']}, {'input': 'wwufuww\\r\\n', 'output': ['6']}, {'input': 'oowoo\\r\\n', 'output': ['4']}, {'input': 'cccaccc\\r\\n', 'output': ['6']}, {'input': 'aaa\\r\\n', 'output': ['0']}, {'input': 'bbbcc\\r\\n', 'output': ['5']}, {'input': 'abcdef\\r\\n', 'output': ['6']}, {'input': 'abbba\\r\\n', 'output': ['4']}, {'input': 'aab\\r\\n', 'output': ['3']}, {'input': 'aaba\\r\\n', 'output': ['4']}, {'input': 'azbyaaa\\r\\n', 'output': ['7']}, {'input': 'oooooiooooo\\r\\n', 'output': ['10']}, {'input': 'aabbbbbaaaaaa\\r\\n', 'output': ['13']}]","id":64} {"description":"Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers\u00a0\u2014 amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.For each two integer numbers a and b such that l\u2009\u2264\u2009a\u2009\u2264\u2009r and x\u2009\u2264\u2009b\u2009\u2264\u2009y there is a potion with experience a and cost b in the store (that is, there are (r\u2009-\u2009l\u2009+\u20091)\u00b7(y\u2009-\u2009x\u2009+\u20091) potions).Kirill wants to buy a potion which has efficiency k. Will he be able to do this?","input_specification":"First string contains five integer numbers l, r, x, y, k (1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009107, 1\u2009\u2264\u2009x\u2009\u2264\u2009y\u2009\u2264\u2009107, 1\u2009\u2264\u2009k\u2009\u2264\u2009107).","output_specification":"Print \"YES\" without quotes if a potion with efficiency exactly k can be bought in the store and \"NO\" without quotes otherwise. You can output each of the letters in any register.","notes":null,"sample_inputs":["1 10 1 10 1","1 5 6 10 1"],"sample_outputs":["YES","NO"],"src_uid":"1110d3671e9f77fd8d66dca6e74d2048","lang_cluster":"Java","difficulty":1200,"human_solution":"import java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n\/* Name of the class has to be \"Main\" only if the class is public. *\/\npublic class Ideone\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t\/\/ your code goes here\n\t\tScanner scan=new Scanner(System.in);\n\t\tint l=scan.nextInt();\n\t\tint r=scan.nextInt();\n\t\tint x=scan.nextInt();\n\t\tint y=scan.nextInt();\n\t\tlong k=scan.nextInt();\n for(int i=x;i<=y;i++)\n if(k*i>=l&&k*i<=r){System.out.println(\"YES\");return;} \n \n System.out.println(\"NO\");\t\n\t\t\n\t}\n}","testcases":"[{'input': '1 10 1 10 1\\r\\n', 'output': ['YES']}, {'input': '1 5 6 10 1\\r\\n', 'output': ['NO']}, {'input': '1 1 1 1 1\\r\\n', 'output': ['YES']}, {'input': '1 1 1 1 2\\r\\n', 'output': ['NO']}, {'input': '1 100000 1 100000 100000\\r\\n', 'output': ['YES']}, {'input': '1 100000 1 100000 100001\\r\\n', 'output': ['NO']}, {'input': '25 10000 200 10000 5\\r\\n', 'output': ['YES']}, {'input': '1 100000 10 100000 50000\\r\\n', 'output': ['NO']}, {'input': '91939 94921 10197 89487 1\\r\\n', 'output': ['NO']}, {'input': '30518 58228 74071 77671 1\\r\\n', 'output': ['NO']}, {'input': '46646 79126 78816 91164 5\\r\\n', 'output': ['NO']}, {'input': '30070 83417 92074 99337 2\\r\\n', 'output': ['NO']}, {'input': '13494 17544 96820 99660 6\\r\\n', 'output': ['NO']}, {'input': '96918 97018 10077 86510 9\\r\\n', 'output': ['YES']}, {'input': '13046 45594 14823 52475 1\\r\\n', 'output': ['YES']}, {'input': '29174 40572 95377 97669 4\\r\\n', 'output': ['NO']}, {'input': '79894 92433 8634 86398 4\\r\\n', 'output': ['YES']}, {'input': '96022 98362 13380 94100 6\\r\\n', 'output': ['YES']}, {'input': '79446 95675 93934 96272 3\\r\\n', 'output': ['NO']}, {'input': '5440 46549 61481 99500 10\\r\\n', 'output': ['NO']}, {'input': '21569 53580 74739 87749 3\\r\\n', 'output': ['NO']}, {'input': '72289 78297 79484 98991 7\\r\\n', 'output': ['NO']}, {'input': '88417 96645 92742 98450 5\\r\\n', 'output': ['NO']}, {'input': '71841 96625 73295 77648 8\\r\\n', 'output': ['NO']}, {'input': '87969 99230 78041 94736 4\\r\\n', 'output': ['NO']}, {'input': '4 4 1 2 3\\r\\n', 'output': ['NO']}, {'input': '150 150 1 2 100\\r\\n', 'output': ['NO']}, {'input': '99 100 1 100 50\\r\\n', 'output': ['YES']}, {'input': '7 7 3 6 2\\r\\n', 'output': ['NO']}, {'input': '10 10 1 10 1\\r\\n', 'output': ['YES']}, {'input': '36 36 5 7 6\\r\\n', 'output': ['YES']}, {'input': '73 96 1 51 51\\r\\n', 'output': ['NO']}, {'input': '3 3 1 3 2\\r\\n', 'output': ['NO']}, {'input': '10000000 10000000 1 100000 10000000\\r\\n', 'output': ['YES']}, {'input': '9222174 9829060 9418763 9955619 9092468\\r\\n', 'output': ['NO']}, {'input': '70 70 1 2 50\\r\\n', 'output': ['NO']}, {'input': '100 200 1 20 5\\r\\n', 'output': ['YES']}, {'input': '1 200000 65536 65536 65537\\r\\n', 'output': ['NO']}, {'input': '15 15 1 100 1\\r\\n', 'output': ['YES']}, {'input': '10000000 10000000 1 10000000 100000\\r\\n', 'output': ['YES']}, {'input': '10 10 2 5 4\\r\\n', 'output': ['NO']}, {'input': '67 69 7 7 9\\r\\n', 'output': ['NO']}, {'input': '100000 10000000 1 10000000 100000\\r\\n', 'output': ['YES']}, {'input': '9 12 1 2 7\\r\\n', 'output': ['NO']}, {'input': '5426234 6375745 2636512 8492816 4409404\\r\\n', 'output': ['NO']}, {'input': '6134912 6134912 10000000 10000000 999869\\r\\n', 'output': ['NO']}, {'input': '3 3 1 100 1\\r\\n', 'output': ['YES']}, {'input': '10000000 10000000 10 10000000 100000\\r\\n', 'output': ['YES']}, {'input': '4 4 1 100 2\\r\\n', 'output': ['YES']}, {'input': '8 13 1 4 7\\r\\n', 'output': ['NO']}, {'input': '10 10 100000 10000000 10000000\\r\\n', 'output': ['NO']}, {'input': '5 6 1 4 2\\r\\n', 'output': ['YES']}, {'input': '1002 1003 1 2 1000\\r\\n', 'output': ['NO']}, {'input': '4 5 1 2 2\\r\\n', 'output': ['YES']}, {'input': '5 6 1 5 1\\r\\n', 'output': ['YES']}, {'input': '15 21 2 4 7\\r\\n', 'output': ['YES']}, {'input': '4 5 3 7 1\\r\\n', 'output': ['YES']}, {'input': '15 15 3 4 4\\r\\n', 'output': ['NO']}, {'input': '3 6 1 2 2\\r\\n', 'output': ['YES']}, {'input': '2 10 3 6 3\\r\\n', 'output': ['YES']}, {'input': '1 10000000 1 10000000 100000\\r\\n', 'output': ['YES']}, {'input': '8 13 1 2 7\\r\\n', 'output': ['NO']}, {'input': '98112 98112 100000 100000 128850\\r\\n', 'output': ['NO']}, {'input': '2 2 1 2 1\\r\\n', 'output': ['YES']}, {'input': '8 8 3 4 2\\r\\n', 'output': ['YES']}, {'input': '60 60 2 3 25\\r\\n', 'output': ['NO']}, {'input': '16 17 2 5 5\\r\\n', 'output': ['NO']}, {'input': '2 4 1 3 1\\r\\n', 'output': ['YES']}, {'input': '4 5 1 2 3\\r\\n', 'output': ['NO']}, {'input': '10 10 3 4 3\\r\\n', 'output': ['NO']}, {'input': '10 10000000 999999 10000000 300\\r\\n', 'output': ['NO']}, {'input': '100 120 9 11 10\\r\\n', 'output': ['YES']}, {'input': '8 20 1 3 4\\r\\n', 'output': ['YES']}, {'input': '10 14 2 3 4\\r\\n', 'output': ['YES']}, {'input': '2000 2001 1 3 1000\\r\\n', 'output': ['YES']}, {'input': '12 13 2 3 5\\r\\n', 'output': ['NO']}, {'input': '7 7 2 3 3\\r\\n', 'output': ['NO']}, {'input': '5 8 1 10000000 4\\r\\n', 'output': ['YES']}, {'input': '5 5 1 1 4\\r\\n', 'output': ['NO']}, {'input': '5 5 1 6 2\\r\\n', 'output': ['NO']}, {'input': '200 300 4000381 4000382 4000381\\r\\n', 'output': ['NO']}, {'input': '11 17 2 5 2\\r\\n', 'output': ['NO']}, {'input': '9999999 10000000 1 10000000 999997\\r\\n', 'output': ['NO']}, {'input': '7 8 2 3 3\\r\\n', 'output': ['NO']}, {'input': '7 7 3 3 2\\r\\n', 'output': ['NO']}, {'input': '15 15 2 3 7\\r\\n', 'output': ['NO']}, {'input': '65408 65408 859 859 10000000\\r\\n', 'output': ['NO']}, {'input': '1000000 10000000 1 100000 1\\r\\n', 'output': ['NO']}, {'input': '6 12 2 3 2\\r\\n', 'output': ['YES']}, {'input': '7 8 1 3 3\\r\\n', 'output': ['NO']}, {'input': '4 4 1 2 2\\r\\n', 'output': ['YES']}, {'input': '2 3 1 2 2\\r\\n', 'output': ['YES']}, {'input': '11 14 2 3 5\\r\\n', 'output': ['NO']}, {'input': '7 7 1 10 3\\r\\n', 'output': ['NO']}, {'input': '49 50 1 2 27\\r\\n', 'output': ['NO']}, {'input': '1 10000000 1 10000000 123456\\r\\n', 'output': ['YES']}, {'input': '100000 10000000 100 10000000 100000\\r\\n', 'output': ['YES']}, {'input': '17 19 2 3 8\\r\\n', 'output': ['NO']}, {'input': '4 6 3 9 1\\r\\n', 'output': ['YES']}, {'input': '19 20 6 7 3\\r\\n', 'output': ['NO']}, {'input': '5000000 10000000 1 4999999 1\\r\\n', 'output': ['NO']}]","id":65} {"description":"Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible.String s consists only of lowercase Latin letters, and it is allowed to change characters only to lowercase Latin letters too.","input_specification":"First line of input contains string s, consisting only of lowercase Latin letters (1\u2009\u2264\u2009|s|\u2009\u2264\u20091000, |s| denotes the length of s). Second line of input contains integer k (1\u2009\u2264\u2009k\u2009\u2264\u200926).","output_specification":"Print single line with a minimum number of necessary changes, or the word \u00abimpossible\u00bb (without quotes) if it is impossible.","notes":"NoteIn the first test case string contains 6 different letters, so we don't need to change anything.In the second test case string contains 4 different letters: {'a',\u2009'h',\u2009'o',\u2009'y'}. To get 5 different letters it is necessary to change one occurrence of 'o' to some letter, which doesn't occur in the string, for example, {'b'}.In the third test case, it is impossible to make 7 different letters because the length of the string is 6.","sample_inputs":["yandex\n6","yahoo\n5","google\n7"],"sample_outputs":["0","1","impossible"],"src_uid":"bd5912fe2c5c37658f28f6b159b39645","lang_cluster":"Java","difficulty":1000,"human_solution":"import java.util.*;\nimport java.io.*;\n\npublic class Solution {\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n String str = scan.next();\n int n = str.length();\n int k = scan.nextInt();\n if(k == 1)\n \tSystem.out.println(0);\n else{\n\t HashSet set = new HashSet();\n\t\t for(int i = 0; i < n; i++)\n\t\t \tset.add(str.charAt(i));\n\t\t int res = (k-set.size());\n\t\t if(k > n)\n\t\t \tSystem.out.println(\"impossible\");\n\t\t else if(res >= 0)\n\t\t \tSystem.out.println(res);\n\t\t else\n\t\t \tSystem.out.println(0);\n\t \t}\n\t\tscan.close();\n\t}\n}","testcases":"[{'input': 'yandex\\r\\n6\\r\\n', 'output': ['0\\r\\n']}, {'input': 'yahoo\\r\\n5\\r\\n', 'output': ['1\\r\\n']}, {'input': 'google\\r\\n7\\r\\n', 'output': ['impossible\\r\\n']}, {'input': 'a\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'z\\r\\n2\\r\\n', 'output': ['impossible\\r\\n']}, {'input': 'fwgfrwgkuwghfiruhewgirueguhergiqrbvgrgf\\r\\n26\\r\\n', 'output': ['14\\r\\n']}, {'input': 'nfevghreuoghrueighoqghbnebvnejbvnbgneluqe\\r\\n26\\r\\n', 'output': ['12\\r\\n']}, {'input': 'a\\r\\n3\\r\\n', 'output': ['impossible\\r\\n']}, {'input': 'smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhegpmmpebqmqpbbeplwaepxmsahuepuhuhwxeqmmlgqubuaxehwuwasgxpqmugbmuawuhwqlswllssueglbxepbmwgs\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'cuguccgcugcugucgggggcgcgucgucugcuuuccccuugccg\\r\\n4\\r\\n', 'output': ['1\\r\\n']}, {'input': 'fcfccfcfccfcfcffcffffffcfccfccfcffccccfcffffccfccfcffcfcccccffcfffcccffcfccfffffcccfccffffffccfccccf\\r\\n20\\r\\n', 'output': ['18\\r\\n']}, {'input': 'swmkwaruyv\\r\\n5\\r\\n', 'output': ['0\\r\\n']}, {'input': 'tnbqpsuhkczmejirvyfdolxwga\\r\\n22\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abcde\\r\\n3\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abb\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'aaaa\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abcde\\r\\n2\\r\\n', 'output': ['0\\r\\n']}, {'input': 'yandex\\r\\n4\\r\\n', 'output': ['0\\r\\n']}, {'input': 'aaabbbccc\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abcd\\r\\n2\\r\\n', 'output': ['0\\r\\n']}, {'input': 'asdfgh\\r\\n2\\r\\n', 'output': ['0\\r\\n']}, {'input': 'aab\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'mynameissako\\r\\n5\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abcde\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abcd\\r\\n3\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abcdef\\r\\n2\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abcdefg\\r\\n4\\r\\n', 'output': ['0\\r\\n']}, {'input': 'abc\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': 'asdafjsgljdllgjdgkl\\r\\n5\\r\\n', 'output': ['0\\r\\n']}, {'input': 'yaay\\r\\n3\\r\\n', 'output': ['1\\r\\n']}, {'input': 'yaay\\r\\n4\\r\\n', 'output': ['2\\r\\n']}, {'input': 'zzzzzz\\r\\n2\\r\\n', 'output': ['1\\r\\n']}]","id":66} {"description":"Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1.You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other n\u2009-\u20091 slimes one by one. When you add a slime, you place it at the right of all already placed slimes. Then, while the last two slimes in the row have the same value v, you combine them together to create a slime with value v\u2009+\u20091.You would like to see what the final state of the row is after you've added all n slimes. Please print the values of the slimes in the row from left to right.","input_specification":"The first line of the input will contain a single integer, n (1\u2009\u2264\u2009n\u2009\u2264\u2009100\u2009000).","output_specification":"Output a single line with k integers, where k is the number of slimes in the row after you've finished the procedure described in the problem statement. The i-th of these numbers should be the value of the i-th slime from the left.","notes":"NoteIn the first sample, we only have a single slime with value 1. The final state of the board is just a single slime with value 1.In the second sample, we perform the following steps:Initially we place a single slime in a row by itself. Thus, row is initially 1.Then, we will add another slime. The row is now 1 1. Since two rightmost slimes have the same values, we should replace these slimes with one with value 2. Thus, the final state of the board is 2.In the third sample, after adding the first two slimes, our row is 2. After adding one more slime, the row becomes 2 1.In the last sample, the steps look as follows: 1 2 2 1 3 3 1 3 2 3 2 1 4 ","sample_inputs":["1","2","3","8"],"sample_outputs":["1","2","2 1","4"],"src_uid":"757cd804aba01dc4bc108cb0722f68dc","lang_cluster":"Java","difficulty":800,"human_solution":"import java.lang.*;\nimport java.util.*;\nimport java.io.*;\npublic class test\n{ \n \n Scanner sc=new Scanner(System.in);\n PrintWriter pr=new PrintWriter(System.out,true);\n public static void main(String... args) \n {\n test c=new test();\n c.prop();\n }\n public void prop() \n {\n int n,count=1 ;\n Stack s=new Stack();\n s.push(0);\n n=sc.nextInt();\n for (int i=1; ;++i) {\n if(n%2==0)\n {\n ++count ;\n n=n\/2 ;\n }else\n {\n s.push(count);\n n=n-1 ;\n }\n if(n==0)\n break ; \n }\n for (; ; ) {\n n=s.pop();\n if(n==0)\n break ;\n else\n pr.print(n+\" \");\n }\n pr.println(\"\");\n \n }\n}","testcases":"[{'input': '1\\r\\n', 'output': ['1']}, {'input': '2\\r\\n', 'output': ['2']}, {'input': '3\\r\\n', 'output': ['2 1', '2 1']}, {'input': '8\\r\\n', 'output': ['4']}, {'input': '100000\\r\\n', 'output': ['17 16 11 10 8 6', '17 16 11 10 8 6']}, {'input': '12345\\r\\n', 'output': ['14 13 6 5 4 1', '14 13 6 5 4 1']}, {'input': '32\\r\\n', 'output': ['6']}, {'input': '70958\\r\\n', 'output': ['17 13 11 9 6 4 3 2', '17 13 11 9 6 4 3 2']}, {'input': '97593\\r\\n', 'output': ['17 15 14 13 12 11 9 6 5 4 1', '17 15 14 13 12 11 9 6 5 4 1']}, {'input': '91706\\r\\n', 'output': ['17 15 14 11 10 6 5 4 2', '17 15 14 11 10 6 5 4 2']}, {'input': '85371\\r\\n', 'output': ['17 15 12 11 9 7 6 5 4 2 1', '17 15 12 11 9 7 6 5 4 2 1']}, {'input': '97205\\r\\n', 'output': ['17 15 14 13 12 10 9 8 6 5 3 1', '17 15 14 13 12 10 9 8 6 5 3 1']}, {'input': '34768\\r\\n', 'output': ['16 11 10 9 8 7 5', '16 11 10 9 8 7 5']}, {'input': '12705\\r\\n', 'output': ['14 13 9 8 6 1', '14 13 9 8 6 1']}, {'input': '30151\\r\\n', 'output': ['15 14 13 11 9 8 7 3 2 1', '15 14 13 11 9 8 7 3 2 1']}, {'input': '4974\\r\\n', 'output': ['13 10 9 7 6 4 3 2', '13 10 9 7 6 4 3 2']}, {'input': '32728\\r\\n', 'output': ['15 14 13 12 11 10 9 8 7 5 4', '15 14 13 12 11 10 9 8 7 5 4']}, {'input': '8192\\r\\n', 'output': ['14']}, {'input': '65536\\r\\n', 'output': ['17']}, {'input': '32\\r\\n', 'output': ['6']}, {'input': '256\\r\\n', 'output': ['9']}, {'input': '4096\\r\\n', 'output': ['13']}, {'input': '33301\\r\\n', 'output': ['16 10 5 3 1', '16 10 5 3 1']}, {'input': '16725\\r\\n', 'output': ['15 9 7 5 3 1', '15 9 7 5 3 1']}, {'input': '149\\r\\n', 'output': ['8 5 3 1', '8 5 3 1']}, {'input': '16277\\r\\n', 'output': ['14 13 12 11 10 9 8 5 3 1', '14 13 12 11 10 9 8 5 3 1']}, {'input': '99701\\r\\n', 'output': ['17 16 11 9 7 6 5 3 1', '17 16 11 9 7 6 5 3 1']}]","id":67} {"description":"Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a \"domino show\".Chris arranges n dominoes in a line, placing each piece vertically upright. In the beginning, he simultaneously pushes some of the dominoes either to the left or to the right. However, somewhere between every two dominoes pushed in the same direction there is at least one domino pushed in the opposite direction.After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right push their adjacent dominoes standing on the right. When a vertical domino has dominoes falling on it from both sides, it stays still due to the balance of the forces. The figure shows one possible example of the process. Given the initial directions Chris has pushed the dominoes, find the number of the dominoes left standing vertically at the end of the process!","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20093000), the number of the dominoes in the line. The next line contains a character string s of length n. The i-th character of the string si is equal to \"L\", if the i-th domino has been pushed to the left; \"R\", if the i-th domino has been pushed to the right; \".\", if the i-th domino has not been pushed. It is guaranteed that if si\u2009=\u2009sj\u2009=\u2009\"L\" and i\u2009<\u2009j, then there exists such k that i\u2009<\u2009k\u2009<\u2009j and sk\u2009=\u2009\"R\"; if si\u2009=\u2009sj\u2009=\u2009\"R\" and i\u2009<\u2009j, then there exists such k that i\u2009<\u2009k\u2009<\u2009j and sk\u2009=\u2009\"L\".","output_specification":"Output a single integer, the number of the dominoes that remain vertical at the end of the process.","notes":"NoteThe first example case is shown on the figure. The four pieces that remain standing vertically are highlighted with orange.In the second example case, all pieces fall down since the first piece topples all the other pieces.In the last example case, a single piece has not been pushed in either direction.","sample_inputs":["14\n.L.R...LR..L..","5\nR....","1\n."],"sample_outputs":["4","0","1"],"src_uid":"54c748dd983b6a0ea1af1153d08f1c01","lang_cluster":"Java","difficulty":1100,"human_solution":"import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int size = Integer.parseInt(scanner.nextLine());\n String input = scanner.nextLine();\n\n boolean lastLeft = true;\n int numStanding = 0;\n int counter = 0;\n\n for (int i = 0; i < input.length(); i++) {\n switch (input.charAt(i)) {\n case 'L':\n \/\/ Special case cause starts with left\n if (!lastLeft) {\n numStanding += (counter%2); \/\/ Add one if odd\n }\n counter = 0;\n lastLeft = true;\n break;\n case 'R':\n numStanding += counter;\n counter = 0;\n lastLeft = false;\n break;\n case '.':\n counter++;\n break;\n default:\n }\n }\n\n if (lastLeft) {\n numStanding += counter;\n }\n\n System.out.println(numStanding);\n }\n}","testcases":"[{'input': '1\\r\\n.\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\nL\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\nR\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\nL.\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\nRL\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n..\\r\\n', 'output': ['2\\r\\n']}, {'input': '6\\r\\n..L.RL\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\nLR\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n.R\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\nR.\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n.L\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\nRLR\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\nLRL\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n.L.R.\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n.R.L.\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\nRL.RL\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\nL.R\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\nR..\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n..RL.\\r\\n', 'output': ['3\\r\\n']}, {'input': '4\\r\\n.LR.\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\nL..\\r\\n', 'output': ['2\\r\\n']}]","id":68} {"description":"\"Hey, it's homework time\" \u2014 thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once.You are given an arbitrary sequence a1,\u2009a2,\u2009...,\u2009an containing n integers. Each integer is not less than 1 and not greater than 5000. Determine what minimum number of elements Polycarpus needs to change to get a permutation (he should not delete or add numbers). In a single change he can modify any single sequence element (i. e. replace it with another integer).","input_specification":"The first line of the input data contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u20095000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u20095000,\u20091\u2009\u2264\u2009i\u2009\u2264\u2009n).","output_specification":"Print the only number \u2014 the minimum number of changes needed to get the permutation.","notes":"NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with number 2.","sample_inputs":["3\n3 1 2","2\n2 2","5\n5 3 3 3 1"],"sample_outputs":["0","1","2"],"src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","lang_cluster":"Java","difficulty":1000,"human_solution":"\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.InputMismatchException;\n\n\n\npublic class Task4 {\n static class FastScanner{\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public FastScanner()\n {\n stream = System.in;\n }\n\n int read()\n {\n if (numChars == -1)\n throw new InputMismatchException();\n if (curChar >= numChars){\n curChar = 0;\n try{\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n boolean isSpaceChar(int c)\n {\n return c==' '||c=='\\n'||c=='\\r'||c=='\\t'||c==-1;\n }\n\n boolean isEndline(int c)\n {\n return c=='\\n'||c=='\\r'||c==-1;\n }\n\n int nextInt()\n {\n return Integer.parseInt(next());\n }\n\n long nextLong()\n {\n return Long.parseLong(next());\n }\n\n double nextDouble()\n {\n return Double.parseDouble(next());\n }\n\n String next(){\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isSpaceChar(c));\n return res.toString();\n }\n\n String nextLine(){\n int c = read();\n while (isEndline(c))\n c = read();\n StringBuilder res = new StringBuilder();\n do{\n res.appendCodePoint(c);\n c = read();\n }while(!isEndline(c));\n return res.toString();\n }\n }\n\n\n\n\n public static void main(String[] args) {\n FastScanner in = new FastScanner();\n byte vis[] =new byte[5005];\n int n = in.nextInt();\n\n\n int ans = 0;\n int t;\n for(int i=0;i n || vis[t]!=0)\n ans++;\n else\n vis[t] = 1;\n }\n System.out.println(ans);\n\n }\n\n\n\n}\n","testcases":"[{'input': '3\\r\\n3 1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n5 3 3 3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n6 6 6 6 6\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n1 1 2 2 8 8 7 7 9 9\\r\\n', 'output': ['5\\r\\n']}, {'input': '8\\r\\n9 8 7 6 5 4 3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '15\\r\\n1 2 3 4 5 5 4 3 2 1 1 2 3 4 5\\r\\n', 'output': ['10\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n5000\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n5000 5000 5000 5000\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n3366 3461 4 5 4370\\r\\n', 'output': ['3\\r\\n']}, {'input': '10\\r\\n8 2 10 3 4 6 1 7 9 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n551 3192 3213 2846 3068 1224 3447 1 10 9\\r\\n', 'output': ['7\\r\\n']}, {'input': '15\\r\\n4 1459 12 4281 3241 2748 10 3590 14 845 3518 1721 2 2880 1974\\r\\n', 'output': ['10\\r\\n']}, {'input': '15\\r\\n15 1 8 2 13 11 12 7 3 14 6 10 9 4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '15\\r\\n2436 2354 4259 1210 2037 2665 700 3578 2880 973 1317 1024 24 3621 4142\\r\\n', 'output': ['15\\r\\n']}, {'input': '30\\r\\n28 1 3449 9 3242 4735 26 3472 15 21 2698 7 4073 3190 10 3 29 1301 4526 22 345 3876 19 12 4562 2535 2 630 18 27\\r\\n', 'output': ['14\\r\\n']}, {'input': '100\\r\\n50 39 95 30 66 78 2169 4326 81 31 74 34 80 40 19 48 97 63 82 6 88 16 21 57 92 77 10 1213 17 93 32 91 38 4375 29 75 44 22 4 45 14 2395 3254 59 3379 2 85 96 8 83 27 94 1512 2960 100 9 73 79 7 25 55 69 90 99 51 87 98 62 18 35 43 4376 4668 28 72 56 4070 61 65 36 54 4106 11 24 15 86 70 71 4087 23 13 76 20 4694 26 4962 4726 37 14 64\\r\\n', 'output': ['18\\r\\n']}, {'input': '100\\r\\n340 14 3275 2283 2673 1107 817 2243 1226 32 2382 3638 4652 418 68 4962 387 764 4647 159 1846 225 2760 4904 3150 403 3 2439 91 4428 92 4705 75 348 1566 1465 69 6 49 4 62 4643 564 1090 3447 1871 2255 139 24 99 2669 969 86 61 4550 158 4537 3993 1589 872 2907 1888 401 80 1825 1483 63 1 2264 4068 4113 2548 41 885 4806 36 67 167 4447 34 1248 2593 82 202 81 1783 1284 4973 16 43 95 7 865 2091 3008 1793 20 947 4912 3604\\r\\n', 'output': ['70\\r\\n']}, {'input': '1\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n5000 5000\\r\\n', 'output': ['2\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n1 2 3 4 5 6 7 1000 10 10\\r\\n', 'output': ['2\\r\\n']}]","id":69} {"description":"\u00abOne dragon. Two dragon. Three dragon\u00bb, \u2014 the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.However, just counting dragons was boring as well, so she entertained herself at best she could. Tonight she imagined that all dragons were here to steal her, and she was fighting them off. Every k-th dragon got punched in the face with a frying pan. Every l-th dragon got his tail shut into the balcony door. Every m-th dragon got his paws trampled with sharp heels. Finally, she threatened every n-th dragon to call her mom, and he withdrew in panic.How many imaginary dragons suffered moral or physical damage tonight, if the princess counted a total of d dragons?","input_specification":"Input data contains integer numbers k,\u2009l,\u2009m,\u2009n and d, each number in a separate line (1\u2009\u2264\u2009k,\u2009l,\u2009m,\u2009n\u2009\u2264\u200910, 1\u2009\u2264\u2009d\u2009\u2264\u2009105).","output_specification":"Output the number of damaged dragons.","notes":"NoteIn the first case every first dragon got punched with a frying pan. Some of the dragons suffered from other reasons as well, but the pan alone would be enough.In the second case dragons 1, 7, 11, 13, 17, 19 and 23 escaped unharmed.","sample_inputs":["1\n2\n3\n4\n12","2\n3\n4\n5\n24"],"sample_outputs":["12","17"],"src_uid":"46bfdec9bfc1e91bd2f5022f3d3c8ce7","lang_cluster":"Java","difficulty":800,"human_solution":"import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner scn=new Scanner(System.in);\n int k=scn.nextInt();\n int l=scn.nextInt();\n int m=scn.nextInt();\n int n=scn.nextInt();\n int d=scn.nextInt();\n int arr[]=new int[d+1];\n for(int i=k;i set[] = new HashSet[m];\n\t\tfor(int i = 0;i < m;i++)\n\t\t\tset[i] = new HashSet<>();\n\t\tfor(int i = 0;i < n;i++)\n\t\t{\n\t\t\tString str=ob.readLine();\n\t\t\tfor(int j = 0;j < m;j++)\n\t\t\t\tset[j].add(str.charAt(j));\n\t\t}\n\t\tfor(int i = 0;i < m;i++)\n\t\t{\t\n\/\/\t\t\tSystem.out.println(\"size = \"+set[i].size());\n\t\t\tans*=set[i].size();\n\t\t\tans%=mod;\n\t\t}\n\t\tSystem.out.println(ans);\n \n\t}\n\t\t\n}","testcases":"[{'input': '2 3\\r\\nAAB\\r\\nBAA\\r\\n', 'output': ['4\\r\\n']}, {'input': '4 5\\r\\nABABA\\r\\nBCGDG\\r\\nAAAAA\\r\\nYABSA\\r\\n', 'output': ['216\\r\\n']}, {'input': '1 1\\r\\nE\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 2\\r\\nNS\\r\\nPD\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 4\\r\\nPJKD\\r\\nNFJX\\r\\nFGFK\\r\\n', 'output': ['81\\r\\n']}, {'input': '4 5\\r\\nSXFMY\\r\\nATHLM\\r\\nKDDQW\\r\\nZWGDS\\r\\n', 'output': ['1024\\r\\n']}, {'input': '20 14\\r\\nJNFKBBBJYZHWQE\\r\\nLBOKZCPFNKDBJY\\r\\nXKNWGHQHIOXUPF\\r\\nDDNRUKVUGHWMXW\\r\\nMTIZFNAAFEAPHX\\r\\nIXBQOOHEULZYHU\\r\\nMRCSREUEOOMUUN\\r\\nHJTSQWKUFYZDQU\\r\\nGMCMUZCOPRVEIQ\\r\\nXBKKGGJECOBLTH\\r\\nXXHTLXCNJZJUAF\\r\\nVLJRKXXXWMTPKZ\\r\\nPTYMNPTBBCWKAD\\r\\nQYJGOBUBHMEDYE\\r\\nGTKUUVVNKAHTUI\\r\\nZNKXYZPCYLBZFP\\r\\nQCBLJTRMBDWNNE\\r\\nTDOKJOBKEOVNLZ\\r\\nFKZUITYAFJOQIM\\r\\nUWQNSGLXEEIRWF\\r\\n', 'output': ['515139391\\r\\n']}, {'input': '5 14\\r\\nAQRXUQQNSKZPGC\\r\\nDTTKSPFGGVCLPT\\r\\nVLZQWWESCHDTAZ\\r\\nCOKOWDWDRUOMHP\\r\\nXDTRBIZTTCIDGS\\r\\n', 'output': ['124999979\\r\\n']}, {'input': '9 23\\r\\nOILBYKHRGMPENVFNHLSIUOW\\r\\nLPJFHTUQUINAALRDGLSQUXR\\r\\nLYYJJEBNZATAFQWTDZSPUNZ\\r\\nHSJPIQKKWWERJZIEMLCZUKI\\r\\nOJYIEYDGPFWRHCMISJCCUEM\\r\\nLMGKZVFYIVDRTIHBWPCNUTG\\r\\nUBGGNCITVHAIPKXCLTSAULQ\\r\\nOWSAWUOXQDBSXXBHTLSXUVD\\r\\nUGQTIZQPBGMASRQPVPSFUWK\\r\\n', 'output': ['454717784\\r\\n']}, {'input': '25 4\\r\\nLVKG\\r\\nMICU\\r\\nZHKW\\r\\nLFGG\\r\\nOWQO\\r\\nLCQG\\r\\nLVXU\\r\\nOUKB\\r\\nLNQX\\r\\nZJTO\\r\\nOOQX\\r\\nLVQP\\r\\nMFQB\\r\\nMRQV\\r\\nOIQH\\r\\nOPXX\\r\\nXFKU\\r\\nFCQB\\r\\nZPKH\\r\\nLVCH\\r\\nNFCU\\r\\nOVQW\\r\\nOZKU\\r\\nLFHX\\r\\nLPXO\\r\\n', 'output': ['5733\\r\\n']}, {'input': '30 10\\r\\nUTNTGOKZYJ\\r\\nQHOUHNYZVW\\r\\nLTVGHJRZVW\\r\\nMZHYHOLZYJ\\r\\nERYEUEPZYE\\r\\nUZDBFTURYJ\\r\\nRVSMQTIZGW\\r\\nWDJQHMIRYY\\r\\nKCORHQPZYE\\r\\nRRPLFOZZVY\\r\\nJTXMFNNNYJ\\r\\nMVTGGOZZVV\\r\\nEHAFFNUZVF\\r\\nLBRNWJZNYE\\r\\nJVMOHTPZYJ\\r\\nWTARFJLZVV\\r\\nLVJCWOURVW\\r\\nLCLQFJYRVV\\r\\nQVBVGNJRYF\\r\\nNTZGHOLRYE\\r\\nMGQKHOUPYJ\\r\\nRRSSBXPZYJ\\r\\nRYCRGTLZYJ\\r\\nJRDEGNKRVW\\r\\nRZKFGHYRVG\\r\\nMDJBFNIZYG\\r\\nMPLWHXIZYE\\r\\nSRZMHMURVE\\r\\nMTEBBMRZYJ\\r\\nJPJIFOLZYM\\r\\n', 'output': ['919913906\\r\\n']}, {'input': '40 7\\r\\nPNTVVER\\r\\nPAHTQDR\\r\\nRXMJVAS\\r\\nVIQNLYC\\r\\nILPUSVX\\r\\nYJOXQDJ\\r\\nSEFODTO\\r\\nOTJMREL\\r\\nLIQRZGD\\r\\nLBJJPOR\\r\\nRUTYHQO\\r\\nRIWEPBD\\r\\nKQUMFIB\\r\\nISTRRYH\\r\\nXBTOTGK\\r\\nRFQODEY\\r\\nHDSTZTP\\r\\nYCXFAGL\\r\\nAREGRFU\\r\\nLELZUYU\\r\\nGVABDKH\\r\\nFJAMMME\\r\\nACVULXE\\r\\nJHVPJAS\\r\\nAAQNMBX\\r\\nJJGUCXG\\r\\nOQATILQ\\r\\nNEOSHJM\\r\\nHFLWOFM\\r\\nICYEQHY\\r\\nFACGLYP\\r\\nPLLXJEQ\\r\\nDCHXYPB\\r\\nAGDDZJJ\\r\\nLSQRXTN\\r\\nHDQZXIY\\r\\nNAHDDWW\\r\\nQCMXRQN\\r\\nFDUDSZO\\r\\nHKBEVTW\\r\\n', 'output': ['206575993\\r\\n']}, {'input': '2 2\\r\\nAA\\r\\nBB\\r\\n', 'output': ['4\\r\\n']}, {'input': '1 10\\r\\nAAAAAAAAAA\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 8\\r\\nAAAAAAAA\\r\\nBBBBBBBB\\r\\n', 'output': ['256\\r\\n']}, {'input': '10 10\\r\\nAAAAAAAAAA\\r\\nBBBBBBBBBB\\r\\nCCCCCCCCCC\\r\\nDDDDDDDDDD\\r\\nAAAAAAAAAA\\r\\nBBBBBBBBBB\\r\\nCCCCCCCCCC\\r\\nDDDDDDDDDD\\r\\nAAAAAAAAAA\\r\\nBBBBBBBBBB\\r\\n', 'output': ['1048576\\r\\n']}, {'input': '1 20\\r\\nAAAAAAAAAAAAAAAAAAAA\\r\\n', 'output': ['1\\r\\n']}, {'input': '20 1\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\n', 'output': ['7\\r\\n']}, {'input': '5 60\\r\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\\r\\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\\r\\nDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\\r\\nEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\\r\\n', 'output': ['449874206\\r\\n']}, {'input': '50 4\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\n', 'output': ['10000\\r\\n']}, {'input': '1 100\\r\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\n', 'output': ['2\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\n', 'output': ['14\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\nW\\r\\nX\\r\\nY\\r\\nZ\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\nW\\r\\nX\\r\\nY\\r\\nZ\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\nW\\r\\nX\\r\\nY\\r\\nZ\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\n', 'output': ['26\\r\\n']}]","id":71} {"description":"Vasya studies music. He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and before C stands H. We will consider the C note in the row's beginning and the C note after the H similar and we will identify them with each other. The distance between the notes along the musical scale is measured in tones: between two consecutive notes there's exactly one semitone, that is, 0.5 tone. The distance is taken from the lowest tone to the uppest one, that is, the distance between C and E is 4 semitones and between E and C is 8 semitonesVasya also knows what a chord is. A chord is an unordered set of no less than three notes. However, for now Vasya only works with triads, that is with the chords that consist of exactly three notes. He can already distinguish between two types of triads \u2014 major and minor.Let's define a major triad. Let the triad consist of notes X, Y and Z. If we can order the notes so as the distance along the musical scale between X and Y equals 4 semitones and the distance between Y and Z is 3 semitones, then the triad is major. The distance between X and Z, accordingly, equals 7 semitones.A minor triad is different in that the distance between X and Y should be 3 semitones and between Y and Z \u2014 4 semitones.For example, the triad \"C E G\" is major: between C and E are 4 semitones, and between E and G are 3 semitones. And the triplet \"C# B F\" is minor, because if we order the notes as \"B C# F\", than between B and C# will be 3 semitones, and between C# and F \u2014 4 semitones.Help Vasya classify the triad the teacher has given to him.","input_specification":"The only line contains 3 space-separated notes in the above-given notation.","output_specification":"Print \"major\" if the chord is major, \"minor\" if it is minor, and \"strange\" if the teacher gave Vasya some weird chord which is neither major nor minor. Vasya promises you that the answer will always be unambiguous. That is, there are no chords that are both major and minor simultaneously.","notes":null,"sample_inputs":["C E G","C# B F","A B H"],"sample_outputs":["major","minor","strange"],"src_uid":"6aa83c2f6e095848bc63aba7d013aa58","lang_cluster":"Java","difficulty":1200,"human_solution":"import java.io.*;\nimport java.math.*;\nimport java.util.*;\n \npublic class A {\n\t\n\t\t\n\t\n\tstatic String[] notes = {\"C\", \"C#\", \"D\", \"D#\", \"E\", \"F\", \"F#\", \"G\", \"G#\", \"A\", \"B\", \"H\" };\n\t\n\tpublic static void main(String[] agrs) {\n\t\tFastScanner sc = new FastScanner();\n\/\/\t\tint yo = sc.nextInt();\n\/\/\t\twhile(yo-->0) {\t\n\/\/\t\t}\n\t\t\n\t\tString s1 = sc.next();\n\t\tString s2 = sc.next();\n\t\tString s3 = sc.next();\n\t\t\n\t\tString[] arr = {s1,s2,s3};\n\t\t\n\t\tboolean vis[] = new boolean[3];\n\t\t\n\t\tString res = gen(arr, new ArrayList(), vis,false);\n\t\t\n\/\/\t\tif(res == null) {\n\/\/\t\t\tSystem.out.println(\"strange\");\n\/\/\t\t}\n\/\/\t\telse {\n\/\/\t\t\tSystem.out.println(res);\n\/\/\t\t}\n\t\tSystem.out.println(ans.equals(\"minor\") || ans.equals(\"major\") ? ans : \"strange\");\n\t\t\n\t\t\n\t\t\n\t\t\n\t} \n\t\n\tstatic String ans = \"\";\n\tstatic boolean is = false;\n\tstatic String gen(String[] arr, List str, boolean[] vis, boolean is) {\n\t\t\n\/\/\t\tSystem.out.println(str);\n\t\tif(is) return null;\n\t\t\n\t\tif(str.size() == 3) {\n\/\/\t\t\tSystem.out.println(str);\n\t\t\tString str1 = check(str);\n\/\/\t\t\tSystem.out.println(str1);\n\t\t\tif(str1.equals(\"major\") || str1.equals(\"minor\")) {\n\t\t\t\tis = true;\n\t\t\t\tans = str1;\n\t\t\t\treturn str1;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t\tfor(int i = 0; i < arr.length; i++) {\n\t\t\tif(vis[i] == false && !is) {\n\t\t\t\tvis[i] = true;\n\t\t\t\tstr.add(arr[i]);\n\t\t\t\tgen(arr,str,vis,is);\n\t\t\t\tstr.remove(str.size()-1);\n\t\t\t\tvis[i] = false;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\t\n\t\n\tstatic String check(List str) {\n\t\t\n\t\tint dist1 = getDistance(str.get(0), str.get(1));\n\t\tint dist2 = getDistance(str.get(1), str.get(2));\n\/\/\t\tSystem.out.println(dist1 + \" \" + dist2);\n\t\tif(dist1 == 4 && dist2 == 3) {\n\t\t\treturn \"major\";\n\t\t}\n\t\tif(dist1 == 3 && dist2 == 4) {\n\t\t\treturn \"minor\";\n\t\t}\n\t\t\n\t\treturn \"\";\n\t}\n\t\n\tstatic int getDistance(String s1, String s2) {\n\t\tint index1 = 0;\n\t\tint index2 = 0;\n\t\tfor(int i = 0; i < notes.length; i++) {\n\t\t\tif(notes[i].equals(s1)) {\n\t\t\t\tindex1 = i;\n\t\t\t}\n\t\t\tif(notes[i].equals(s2)) {\n\t\t\t\tindex2 = i;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(index1 < index2) {\n\t\t\treturn index2 - index1;\n\t\t}\n\t\telse {\n\t\t\treturn (notes.length-index1) + Math.abs(index2);\n\t\t}\n\t\t\n\/\/\t\tindex2-index1 < 0 ? Math.abs(index2-index1)*2 : \n\t}\n\t\n\t\n\t\n\n\n\n\n\n\n\n\n\tstatic int gcd(int a, int b) {\n\t\treturn a%b == 0 ? b : gcd(b,a%b);\n\t}\n\t\n\tstatic int mod = 1000000007;\n\t\n\tstatic long pow(int a, int b) {\n\t\tif(b == 0) {\n\t\t\treturn 1;\n\t\t}\n\t\tif(b == 1) {\n\t\t\treturn a;\n\t\t}\n\t\tif(b%2 == 0) {\n\t\t\n\t\t\tlong ans = pow(a,b\/2);\n\t\t\treturn ans*ans;\n\t\t}\n\t\telse {\n\t\t\tlong ans = pow(a,(b-1)\/2);\n\t\t\treturn a * ans * ans;\n\t\t}\n\t\t\n\t}\n\t\n\tstatic boolean[] sieve(int n) {\n\t\t\n\t\tboolean isPrime[] = new boolean[n+1];\n\t\tfor(int i = 2; i <= n; i++) {\n\t\t\tif(isPrime[i]) continue;\n\t\t\tfor(int j = 2*i; j <= n; j+=i) {\n\t\t\t\tisPrime[j] = true;\n\t\t\t}\t\t\n\t\t}\n\t\treturn isPrime;\n\t}\n\t\n\n\tstatic class FastScanner {\n\t\tBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st=new StringTokenizer(\"\");\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tint[] readArray(int n) {\n\t\t\tint[] a=new int[n];\n\t\t\tfor (int i=0; i= count7) {\n System.out.println(4);\n } else {\n System.out.println(7);\n }\n } else {\n System.out.println(-1);\n }\n\n }\n}","testcases":"[{'input': '047\\r\\n', 'output': ['4']}, {'input': '16\\r\\n', 'output': ['-1']}, {'input': '472747\\r\\n', 'output': ['7']}, {'input': '1925\\r\\n', 'output': ['-1']}, {'input': '5486846414848445484\\r\\n', 'output': ['4']}, {'input': '516160414\\r\\n', 'output': ['4']}, {'input': '9458569865994896\\r\\n', 'output': ['4']}, {'input': '94894948577777777884888\\r\\n', 'output': ['7']}, {'input': '00000\\r\\n', 'output': ['-1']}, {'input': '9589\\r\\n', 'output': ['-1']}, {'input': '7665711\\r\\n', 'output': ['7']}, {'input': '538772857\\r\\n', 'output': ['7']}, {'input': '8679647744\\r\\n', 'output': ['4']}, {'input': '23607019991994\\r\\n', 'output': ['4']}, {'input': '86145305734278927901987281894864719533015270066521\\r\\n', 'output': ['7']}, {'input': '22438808523154336905543301642540261833729318191\\r\\n', 'output': ['4']}, {'input': '290732082244359495795943967215788554387079\\r\\n', 'output': ['7']}, {'input': '6363333480463521971676988087733137609715\\r\\n', 'output': ['7']}, {'input': '637789221789855555993957058\\r\\n', 'output': ['7']}, {'input': '11536708648794535307468278326553811\\r\\n', 'output': ['7']}, {'input': '619433861636130069773\\r\\n', 'output': ['7']}, {'input': '7\\r\\n', 'output': ['7']}, {'input': '00000000000000000000000000000000000000000000000000\\r\\n', 'output': ['-1']}, {'input': '0000000000000000000000000000000000000047\\r\\n', 'output': ['4']}, {'input': '8175012266795100056032281135654854227489558885698\\r\\n', 'output': ['4']}, {'input': '8862708665262955384044574268728167940741129\\r\\n', 'output': ['4']}, {'input': '538772857\\r\\n', 'output': ['7']}, {'input': '94872076199824813574576121510803\\r\\n', 'output': ['7']}, {'input': '44101164480392494025995467\\r\\n', 'output': ['4']}, {'input': '0445460407410702955646485\\r\\n', 'output': ['4']}, {'input': '91076008557028243309\\r\\n', 'output': ['7']}, {'input': '33120039\\r\\n', 'output': ['-1']}, {'input': '4\\r\\n', 'output': ['4']}, {'input': '74747474747474747474747474747474747474747474747474\\r\\n', 'output': ['4']}, {'input': '74747474747474747474747774747474747474747474747474\\r\\n', 'output': ['7']}, {'input': '74747474747474747474747474747474744474747474747474\\r\\n', 'output': ['4']}, {'input': '47474747474747474747474747474747474747474747474747\\r\\n', 'output': ['4']}, {'input': '40\\r\\n', 'output': ['4']}, {'input': '07\\r\\n', 'output': ['7']}, {'input': '007\\r\\n', 'output': ['7']}, {'input': '44\\r\\n', 'output': ['4']}, {'input': '74\\r\\n', 'output': ['4']}]","id":74} {"description":"A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volume in each of the n mugs must be the same.Polycarpus has already began the process and he partially emptied the Ber-Cola bottle. Now the first mug has a1 milliliters of the drink, the second one has a2 milliliters and so on. The bottle has b milliliters left and Polycarpus plans to pour them into the mugs so that the main equation was fulfilled.Write a program that would determine what volume of the drink Polycarpus needs to add into each mug to ensure that the following two conditions were fulfilled simultaneously: there were b milliliters poured in total. That is, the bottle need to be emptied; after the process is over, the volumes of the drink in the mugs should be equal. ","input_specification":"The first line contains a pair of integers n, b (2\u2009\u2264\u2009n\u2009\u2264\u2009100,\u20091\u2009\u2264\u2009b\u2009\u2264\u2009100), where n is the total number of friends in the group and b is the current volume of drink in the bottle. The second line contains a sequence of integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u2009100), where ai is the current volume of drink in the i-th mug.","output_specification":"Print a single number \"-1\" (without the quotes), if there is no solution. Otherwise, print n float numbers c1,\u2009c2,\u2009...,\u2009cn, where ci is the volume of the drink to add in the i-th mug. Print the numbers with no less than 6 digits after the decimal point, print each ci on a single line. Polycarpus proved that if a solution exists then it is unique. Russian locale is installed by default on the testing computer. Make sure that your solution use the point to separate the integer part of a real number from the decimal, not a comma.","notes":null,"sample_inputs":["5 50\n1 2 3 4 5","2 2\n1 100"],"sample_outputs":["12.000000\n11.000000\n10.000000\n9.000000\n8.000000","-1"],"src_uid":"65fea461d3caa5a932d1e2c13e99a59e","lang_cluster":"Java","difficulty":1100,"human_solution":"\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.Scanner;\n\npublic class Solution {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n String[] first = in.nextLine().split(\" \");\n int n = Integer.valueOf(first[0]);\n int b = Integer.valueOf(first[1]);\n \n String[] second = in.nextLine().split(\" \");\n int[] c = new int[second.length];\n int sum = 0;\n for (int i = 0; i < c.length; i++) {\n \tc[i] = Integer.valueOf(second[i]);\n \tsum += c[i];\n }\n \n double q = (double)(b + sum) \/ n;\n String result = \"\";\n for (int i = 0; i < c.length; i++) {\n \tif (c[i] > q) {\n \t\tSystem.out.println(-1);\n \t\treturn;\n \t}\n \tresult += String.format(new Locale(\"Russian\"), \"%.6f\", (q - c[i])) + \"\\n\";\n }\n \n System.out.println(result);\n }\n}","testcases":"[{'input': '5 50\\r\\n1 2 3 4 5\\r\\n', 'output': ['12.000000\\r\\n11.000000\\r\\n10.000000\\r\\n9.000000\\r\\n8.000000\\r\\n']}, {'input': '2 2\\r\\n1 100\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n1 1\\r\\n', 'output': ['1.000000\\r\\n1.000000\\r\\n']}, {'input': '3 2\\r\\n1 2 1\\r\\n', 'output': ['1.000000\\r\\n0.000000\\r\\n1.000000\\r\\n']}, {'input': '3 5\\r\\n1 2 1\\r\\n', 'output': ['2.000000\\r\\n1.000000\\r\\n2.000000\\r\\n']}, {'input': '10 95\\r\\n0 0 0 0 0 1 1 1 1 1\\r\\n', 'output': ['10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n']}, {'input': '3 5\\r\\n1 2 3\\r\\n', 'output': ['2.666667\\r\\n1.666667\\r\\n0.666667\\r\\n']}, {'input': '3 5\\r\\n1 3 2\\r\\n', 'output': ['2.666667\\r\\n0.666667\\r\\n1.666667\\r\\n']}, {'input': '3 5\\r\\n2 1 3\\r\\n', 'output': ['1.666667\\r\\n2.666667\\r\\n0.666667\\r\\n']}, {'input': '3 5\\r\\n2 3 1\\r\\n', 'output': ['1.666667\\r\\n0.666667\\r\\n2.666667\\r\\n']}, {'input': '3 5\\r\\n3 1 2\\r\\n', 'output': ['0.666667\\r\\n2.666667\\r\\n1.666667\\r\\n']}, {'input': '3 5\\r\\n3 2 1\\r\\n', 'output': ['0.666667\\r\\n1.666667\\r\\n2.666667\\r\\n']}, {'input': '2 1\\r\\n1 1\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '2 1\\r\\n2 2\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '3 2\\r\\n2 1 2\\r\\n', 'output': ['0.333333\\r\\n1.333333\\r\\n0.333333\\r\\n']}, {'input': '3 3\\r\\n2 2 1\\r\\n', 'output': ['0.666667\\r\\n0.666667\\r\\n1.666667\\r\\n']}, {'input': '3 3\\r\\n3 1 2\\r\\n', 'output': ['0.000000\\r\\n2.000000\\r\\n1.000000\\r\\n']}, {'input': '100 100\\r\\n37 97 75 52 33 29 51 22 33 37 45 96 96 60 82 58 86 71 28 73 38 50 6 6 90 17 26 76 13 41 100 47 17 93 4 1 56 16 41 74 25 17 69 61 39 37 96 73 49 93 52 14 62 24 91 30 9 97 52 100 6 16 85 8 12 26 10 3 94 63 80 27 29 78 9 48 79 64 60 18 98 75 81 35 24 81 2 100 23 70 21 60 98 38 29 29 58 37 49 72\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 100\\r\\n1 3 7 7 9 5 9 3 7 8 10 1 3 10 10 6 1 3 10 4 3 9 4 9 5 4 9 2 8 7 4 3 3 3 5 10 8 9 10 1 9 2 4 8 3 10 9 2 3 9 8 2 4 4 4 7 1 1 7 3 7 8 9 5 1 2 6 7 1 10 9 10 5 10 1 10 5 2 4 3 10 1 6 5 6 7 8 9 3 8 6 10 8 7 2 3 8 6 3 6\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 61\\r\\n81 80 83 72 87 76 91 92 77 93 77 94 76 73 71 88 88 76 87 73 89 73 85 81 79 90 76 73 82 93 79 93 71 75 72 71 78 85 92 89 88 93 74 87 71 94 74 87 85 89 90 93 86 94 92 87 90 91 75 73 90 84 92 94 92 79 74 85 74 74 89 76 84 84 84 83 86 84 82 71 76 74 83 81 89 73 73 74 71 77 90 94 73 94 73 75 93 89 84 92\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10 100\\r\\n52 52 51 52 52 52 51 51 52 52\\r\\n', 'output': ['9.700000\\r\\n9.700000\\r\\n10.700000\\r\\n9.700000\\r\\n9.700000\\r\\n9.700000\\r\\n10.700000\\r\\n10.700000\\r\\n9.700000\\r\\n9.700000\\r\\n']}, {'input': '10 100\\r\\n13 13 13 13 12 13 12 13 12 12\\r\\n', 'output': ['9.600000\\r\\n9.600000\\r\\n9.600000\\r\\n9.600000\\r\\n10.600000\\r\\n9.600000\\r\\n10.600000\\r\\n9.600000\\r\\n10.600000\\r\\n10.600000\\r\\n']}, {'input': '10 100\\r\\n50 51 47 51 48 46 49 51 46 51\\r\\n', 'output': ['9.000000\\r\\n8.000000\\r\\n12.000000\\r\\n8.000000\\r\\n11.000000\\r\\n13.000000\\r\\n10.000000\\r\\n8.000000\\r\\n13.000000\\r\\n8.000000\\r\\n']}, {'input': '10 100\\r\\n13 13 9 12 12 11 13 8 10 13\\r\\n', 'output': ['8.400000\\r\\n8.400000\\r\\n12.400000\\r\\n9.400000\\r\\n9.400000\\r\\n10.400000\\r\\n8.400000\\r\\n13.400000\\r\\n11.400000\\r\\n8.400000\\r\\n']}, {'input': '13 97\\r\\n52 52 51 51 52 52 51 52 51 51 52 52 52\\r\\n', 'output': ['7.076923\\r\\n7.076923\\r\\n8.076923\\r\\n8.076923\\r\\n7.076923\\r\\n7.076923\\r\\n8.076923\\r\\n7.076923\\r\\n8.076923\\r\\n8.076923\\r\\n7.076923\\r\\n7.076923\\r\\n7.076923\\r\\n']}, {'input': '17 99\\r\\n13 13 12 13 11 12 12 12 13 13 11 13 13 13 13 12 13\\r\\n', 'output': ['5.294118\\r\\n5.294118\\r\\n6.294118\\r\\n5.294118\\r\\n7.294118\\r\\n6.294118\\r\\n6.294118\\r\\n6.294118\\r\\n5.294118\\r\\n5.294118\\r\\n7.294118\\r\\n5.294118\\r\\n5.294118\\r\\n5.294118\\r\\n5.294118\\r\\n6.294118\\r\\n5.294118\\r\\n']}, {'input': '9 91\\r\\n52 51 50 52 52 51 50 48 51\\r\\n', 'output': ['8.888889\\r\\n9.888889\\r\\n10.888889\\r\\n8.888889\\r\\n8.888889\\r\\n9.888889\\r\\n10.888889\\r\\n12.888889\\r\\n9.888889\\r\\n']}, {'input': '17 91\\r\\n13 13 13 13 12 12 13 13 12 13 12 13 10 12 13 13 12\\r\\n', 'output': ['4.823529\\r\\n4.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n5.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n4.823529\\r\\n5.823529\\r\\n4.823529\\r\\n7.823529\\r\\n5.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n']}, {'input': '2 3\\r\\n1 1\\r\\n', 'output': ['1.500000\\r\\n1.500000\\r\\n']}, {'input': '2 90\\r\\n0 89\\r\\n', 'output': ['89.500000\\r\\n0.500000\\r\\n']}, {'input': '4 17\\r\\n3 4 8 1\\r\\n', 'output': ['5.250000\\r\\n4.250000\\r\\n0.250000\\r\\n7.250000\\r\\n']}, {'input': '2 9\\r\\n5 5\\r\\n', 'output': ['4.500000\\r\\n4.500000\\r\\n']}, {'input': '7 28\\r\\n1 3 9 10 9 6 10\\r\\n', 'output': ['9.857143\\r\\n7.857143\\r\\n1.857143\\r\\n0.857143\\r\\n1.857143\\r\\n4.857143\\r\\n0.857143\\r\\n']}, {'input': '5 11\\r\\n1 2 3 4 5\\r\\n', 'output': ['4.200000\\r\\n3.200000\\r\\n2.200000\\r\\n1.200000\\r\\n0.200000\\r\\n']}, {'input': '2 1\\r\\n1 1\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '5 3\\r\\n1 1 1 1 1\\r\\n', 'output': ['0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n']}, {'input': '3 1\\r\\n100 100 100\\r\\n', 'output': ['0.333333\\r\\n0.333333\\r\\n0.333333\\r\\n']}, {'input': '5 50\\r\\n2 2 3 2 2\\r\\n', 'output': ['10.200000\\r\\n10.200000\\r\\n9.200000\\r\\n10.200000\\r\\n10.200000\\r\\n']}, {'input': '3 3\\r\\n2 2 3\\r\\n', 'output': ['1.333333\\r\\n1.333333\\r\\n0.333333\\r\\n']}, {'input': '2 52\\r\\n2 100\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 2\\r\\n2 2 3\\r\\n', 'output': ['1.000000\\r\\n1.000000\\r\\n0.000000\\r\\n']}, {'input': '5 1\\r\\n1 1 1 1 1\\r\\n', 'output': ['0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n']}, {'input': '2 4\\r\\n1 2\\r\\n', 'output': ['2.500000\\r\\n1.500000\\r\\n']}, {'input': '5 49\\r\\n1 2 3 4 5\\r\\n', 'output': ['11.800000\\r\\n10.800000\\r\\n9.800000\\r\\n8.800000\\r\\n7.800000\\r\\n']}]","id":75} {"description":"Dwarfs have planted a very interesting plant, which is a triangle directed \"upwards\". This plant has an amusing feature. After one year a triangle plant directed \"upwards\" divides into four triangle plants: three of them will point \"upwards\" and one will point \"downwards\". After another year, each triangle plant divides into four triangle plants: three of them will be directed in the same direction as the parent plant, and one of them will be directed in the opposite direction. Then each year the process repeats. The figure below illustrates this process. Help the dwarfs find out how many triangle plants that point \"upwards\" will be in n years.","input_specification":"The first line contains a single integer n (0\u2009\u2264\u2009n\u2009\u2264\u20091018) \u2014 the number of full years when the plant grew. Please do not use the %lld specifier to read or write 64-bit integers in \u0421++. It is preferred to use cin, cout streams or the %I64d specifier.","output_specification":"Print a single integer \u2014 the remainder of dividing the number of plants that will point \"upwards\" in n years by 1000000007 (109\u2009+\u20097).","notes":"NoteThe first test sample corresponds to the second triangle on the figure in the statement. The second test sample corresponds to the third one.","sample_inputs":["1","2"],"sample_outputs":["3","10"],"src_uid":"782b819eb0bfc86d6f96f15ac09d5085","lang_cluster":"Java","difficulty":1300,"human_solution":"\nimport java.util.Scanner;\n\n\/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n *\/\n\n\/**\n *\n * @author Andy Phan\n *\/\npublic class p185a {\n static long MOD = 1000000007;\n \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n long a = in.nextLong();\n if(a == 0) System.out.println(1);\n else System.out.println(mult(new long[][] {{1, 0}}, expo(new long[][] {{3, 1}, {1, 3}}, a))[0][0]);\n }\n \n static long[][] mult(long[][] a, long[][] b) {\n long[][] res = new long[a.length][b[0].length];\n for(int i = 0; i < a.length; i++) {\n for(int j = 0; j < b[0].length; j++) {\n for(int k = 0; k < a[0].length; k++) {\n res[i][j] = (res[i][j] + a[i][k]*b[k][j])%MOD;\n }\n }\n }\n return res;\n }\n \n static long[][] expo(long[][] base, long pow) {\n if(pow == 1) return base;\n long[][] tmp = expo(base, pow\/2);\n tmp = mult(tmp, tmp);\n if(pow%2 == 1) tmp = mult(tmp, base);\n return tmp;\n }\n}\n","testcases":"[{'input': ['1\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['2\\r\\n'], 'output': ['10\\r\\n']}, {'input': ['385599124\\r\\n'], 'output': ['493875375\\r\\n']}, {'input': ['989464295\\r\\n'], 'output': ['31966163\\r\\n']}, {'input': ['376367012\\r\\n'], 'output': ['523204186\\r\\n']}, {'input': ['529357306\\r\\n'], 'output': ['142578489\\r\\n']}, {'input': ['782916801\\r\\n'], 'output': ['51174574\\r\\n']}, {'input': ['74859961358140080\\r\\n'], 'output': ['478768275\\r\\n']}, {'input': ['0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['252509053898415171\\r\\n'], 'output': ['886314547\\r\\n']}, {'input': ['760713016078377938\\r\\n'], 'output': ['79611270\\r\\n']}, {'input': ['919845424847912644\\r\\n'], 'output': ['388845650\\r\\n']}, {'input': ['585335721566249104\\r\\n'], 'output': ['301383716\\r\\n']}, {'input': ['522842183413115087\\r\\n'], 'output': ['556012763\\r\\n']}, {'input': ['148049062285906746\\r\\n'], 'output': ['913927498\\r\\n']}, {'input': ['84324827171274022\\r\\n'], 'output': ['462535280\\r\\n']}, {'input': ['354979172034763159\\r\\n'], 'output': ['239287993\\r\\n']}, {'input': ['1312148742261680\\r\\n'], 'output': ['799725655\\r\\n']}, {'input': ['269587448053313253\\r\\n'], 'output': ['536645997\\r\\n']}, {'input': ['645762257531682045\\r\\n'], 'output': ['543988614\\r\\n']}, {'input': ['615812227854199662\\r\\n'], 'output': ['357939938\\r\\n']}, {'input': ['819875140559301751\\r\\n'], 'output': ['968653685\\r\\n']}, {'input': ['349993003033420740\\r\\n'], 'output': ['709392758\\r\\n']}, {'input': ['891351282398722856\\r\\n'], 'output': ['70758467\\r\\n']}, {'input': ['563324730406715801\\r\\n'], 'output': ['353494903\\r\\n']}, {'input': ['520974001002628386\\r\\n'], 'output': ['164118419\\r\\n']}, {'input': ['666729339260489789\\r\\n'], 'output': ['784700006\\r\\n']}, {'input': ['856674609788912527\\r\\n'], 'output': ['720540265\\r\\n']}, {'input': ['791809296233191092\\r\\n'], 'output': ['369199735\\r\\n']}, {'input': ['711066335916901717\\r\\n'], 'output': ['15590358\\r\\n']}, {'input': ['931356501703211379\\r\\n'], 'output': ['239824013\\r\\n']}, {'input': ['234122431978145893\\r\\n'], 'output': ['905163056\\r\\n']}, {'input': ['1000000000000000000\\r\\n'], 'output': ['899770636\\r\\n']}, {'input': ['3\\r\\n'], 'output': ['36\\r\\n']}, {'input': ['4\\r\\n'], 'output': ['136\\r\\n']}, {'input': ['5\\r\\n'], 'output': ['528\\r\\n']}, {'input': ['6\\r\\n'], 'output': ['2080\\r\\n']}, {'input': ['7\\r\\n'], 'output': ['8256\\r\\n']}, {'input': ['8\\r\\n'], 'output': ['32896\\r\\n']}, {'input': ['9\\r\\n'], 'output': ['131328\\r\\n']}, {'input': ['10\\r\\n'], 'output': ['524800\\r\\n']}, {'input': ['11\\r\\n'], 'output': ['2098176\\r\\n']}, {'input': ['12\\r\\n'], 'output': ['8390656\\r\\n']}, {'input': ['13\\r\\n'], 'output': ['33558528\\r\\n']}, {'input': ['14\\r\\n'], 'output': ['134225920\\r\\n']}, {'input': ['15\\r\\n'], 'output': ['536887296\\r\\n']}, {'input': ['16\\r\\n'], 'output': ['147516402\\r\\n']}, {'input': ['0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['6265\\r\\n'], 'output': ['980996097\\r\\n']}]","id":76} {"description":"Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two conditions: After the cutting each ribbon piece should have length a, b or c. After the cutting the number of ribbon pieces should be maximum. Help Polycarpus and find the number of ribbon pieces after the required cutting.","input_specification":"The first line contains four space-separated integers n, a, b and c (1\u2009\u2264\u2009n,\u2009a,\u2009b,\u2009c\u2009\u2264\u20094000) \u2014 the length of the original ribbon and the acceptable lengths of the ribbon pieces after the cutting, correspondingly. The numbers a, b and c can coincide.","output_specification":"Print a single number \u2014 the maximum possible number of ribbon pieces. It is guaranteed that at least one correct ribbon cutting exists.","notes":"NoteIn the first example Polycarpus can cut the ribbon in such way: the first piece has length 2, the second piece has length 3.In the second example Polycarpus can cut the ribbon in such way: the first piece has length 5, the second piece has length 2.","sample_inputs":["5 5 3 2","7 5 5 2"],"sample_outputs":["2","2"],"src_uid":"062a171cc3ea717ea95ede9d7a1c3a43","lang_cluster":"Java","difficulty":1300,"human_solution":"import java.io.DataInputStream; \nimport java.io.FileInputStream; \nimport java.io.IOException; \nimport java.io.InputStreamReader; \nimport java.util.*;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\n\npublic class JavaApplication9 { \n \n \n\/\/*************************************************************************************** \n static class Reader \n { \n final private int BUFFER_SIZE = 1 << 16; \n private DataInputStream din; \n private byte[] buffer; \n private int bufferPointer, bytesRead; \n \n public Reader() \n { \n din = new DataInputStream(System.in); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public Reader(String file_name) throws IOException \n { \n din = new DataInputStream(new FileInputStream(file_name)); \n buffer = new byte[BUFFER_SIZE]; \n bufferPointer = bytesRead = 0; \n } \n \n public String readLine() throws IOException \n { \n byte[] buf = new byte[64]; \/\/ line length \n int cnt = 0, c; \n while ((c = read()) != -1) \n { \n if (c == '\\n') \n break; \n buf[cnt++] = (byte) c; \n } \n return new String(buf, 0, cnt); \n } \n \n public int nextInt() throws IOException \n { \n int ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do\n { \n ret = ret * 10 + c - '0'; \n } while ((c = read()) >= '0' && c <= '9'); \n \n if (neg) \n return -ret; \n return ret; \n } \n \n public long nextLong() throws IOException \n { \n long ret = 0; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n if (neg) \n return -ret; \n return ret; \n } \n \n public double nextDouble() throws IOException \n { \n double ret = 0, div = 1; \n byte c = read(); \n while (c <= ' ') \n c = read(); \n boolean neg = (c == '-'); \n if (neg) \n c = read(); \n \n do { \n ret = ret * 10 + c - '0'; \n } \n while ((c = read()) >= '0' && c <= '9'); \n \n if (c == '.') \n { \n while ((c = read()) >= '0' && c <= '9') \n { \n ret += (c - '0') \/ (div *= 10); \n } \n } \n \n if (neg) \n return -ret; \n return ret; \n } \n \n private void fillBuffer() throws IOException \n { \n bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); \n if (bytesRead == -1) \n buffer[0] = -1; \n } \n \n private byte read() throws IOException \n { \n if (bufferPointer == bytesRead) \n fillBuffer(); \n return buffer[bufferPointer++]; \n } \n \n public void close() throws IOException \n { \n if (din == null) \n return; \n din.close(); \n } \n }\n\/\/**************************************************************************************** \n\/*static boolean isp(long n)\n{\n\n if(n==3||n==2)\n return true;\n if(n%2==0||n%3==0||n==1)\n return false;\n for(int i=5;i*i<=n;i=i+6)\n {\n if(n%i==0||n%(i+2)==0)\n return false;\n }\n return true;\n} *\/\n\/\/******************************************************** \n \/* static int factorial(int n) \n { \n if (n == 0) \n return 1; \n \n return n*factorial(n-1); \n } *\/ \npublic static void main(String[] args) throws IOException{\n\nReader st=new Reader();\nint n=st.nextInt(),a=st.nextInt(),b=st.nextInt(),c=st.nextInt();int min,r; int cr[]=new int[3];cr[0]=a;cr[1]=b;cr[2]=c;\nfor(int j=0;j<2;j++){min=j;for(int i=j+1;i<3;i++){if(cr[i]0)\n {\n m=q*a;\n x=n-m;\n if(x%b==0){B=true; break;} \n else\n q--;\n \n }int cc6=0;\n if(B)\n {\n cc6=q+(x\/b);\n }\n int cc5=0;\n if(n%b==0)cc5=n\/b;\n \n \/\/*************************************************************************************\n { int cc1=0;\n q=n\/a;\n while(q>0){m=q*a;x=n-m; if(x%c==0){C=true; break;} else q--;} \/\/by+cz \n if(C){cc1=q+(x\/c);}\n \/\/***********************************************\n q=n\/b;C=false; int cc2=0;\n while(q>0){m=q*b;x=n-m; if(x%c==0){C=true; break;} else q--;} \/\/ax+cz\n if(C){cc2=q+(x\/c);}\n \/\/*****************************\n int cc3=0;\n if(n%c==0){cc3=n\/c;} \/\/cz\n \/\/****************************\n int maxb=n\/b,maxc=n\/c,coa=0,cob=0,coc=0,cc4=0; \n double s,xx;\n \/\/for(int t=b+c;t<((maxb*b)+(maxc*c));t++) \/\/ax+by+cz\n int h=b+c;\n if(h>n)h=n;\n while(h<=((maxb*b)+(maxc*c)))\n {\n \n s=n-h;\n \n xx=s\/a; \/\/coa\n if(xx%a==0||a%xx==0){coa=(int)xx;break;}h++;\n }\n \/\/**********************************************************\n int maxa=n\/a; \n int t=((maxb*b)+(maxa*a));\n if(t>n){t=n;}\n while(t>=b+a) \/\/coc\n {\n \n s=n-t;\n if(s>=c){\n xx=s\/c;\n if(xx%c==0||c%xx==0){coc=(int)xx;break;}}\n t--;\n }\n \/\/**********************************************************\n \n cob=(n-(coa*a+coc*c))\/b; \/\/cob\n \/\/*****************************************************\n \n if(coc>0&coa>0&&coa*a+cob*b+coc*c==n){\n cc4=coa+cob+coc;}\n else\n {\n while(coa*a+cob*b+coc*c!=n&cob>0&coc<=maxc){coc++;cob--;}\n }\n if(coc>0&coa>0&&coa*a+cob*b+coc*c==n) cc4=coa+cob+coc;else cc4=0;\n int yy=cc1;\n if(yy 0 ? next_left[i][j - 1] : -1));\n if(s[i].charAt(j) == '1' && left_most[i] == -1){\n left_most[i] = j;\n }\n }\n for(int j = m - 1;j >= 0;--j){\n next_right[i][j] = (s[i].charAt(j) == '1' ? j : (j < m - 1 ? next_right[i][j + 1] : -1));\n if(s[i].charAt(j) == '1' && right_most[i] == -1){\n right_most[i] = j;\n }\n }\n }\n int ans = (int)(1e9);\n for(int j = 0;j < m;++j){\n int tmp = 0;\n for(int i = 0;i < n;++i){\n int f = (int)(1e9);\n if(left_most[i] != -1){\n f = Math.min(f,left_most[i] + m - j);\n }\n if(right_most[i] != -1){\n f = Math.min(f,m - right_most[i] + j);\n }\n if(next_right[i][j] != -1){\n f = Math.min(f,next_right[i][j] - j);\n }\n if(next_left[i][j] != -1){\n f = Math.min(f,j - next_left[i][j]);\n }\n if(f == (int)(1e9)){\n tmp = (int)(1e9);\n } else {\n tmp += f;\n }\n }\n ans = Math.min(ans,tmp);\n }\n out.print(ans == (int)1e9 ? -1 : ans);\n }\n }\n\n static class InputReader{\n public BufferedReader reader;\n public StringTokenizer tokenizer;\n\n public InputReader(InputStream stream){\n reader = new BufferedReader(new InputStreamReader(stream));\n tokenizer = null;\n }\n\n public String next(){\n while(tokenizer == null || !tokenizer.hasMoreTokens()){\n try{\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e){\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt(){\n return Integer.parseInt(next());\n }\n\n public long nextLong(){\n return Long.parseLong(next());\n }\n\n public double nextDouble(){\n return Double.parseDouble(next());\n }\n\n public String nextLine(){\n String ret_str = \"\";\n try {\n ret_str = reader.readLine();\n } catch (IOException e){\n e.printStackTrace();\n }\n return ret_str;\n }\n }\n}\n","testcases":"[{'input': '3 6\\r\\n101010\\r\\n000100\\r\\n100000\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 3\\r\\n111\\r\\n000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1 1\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 1\\r\\n1\\r\\n1\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '6 2\\r\\n10\\r\\n11\\r\\n01\\r\\n01\\r\\n10\\r\\n11\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 3\\r\\n001\\r\\n010\\r\\n100\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 4\\r\\n0001\\r\\n0100\\r\\n0010\\r\\n1000\\r\\n', 'output': ['4\\r\\n']}, {'input': '5 5\\r\\n10000\\r\\n01000\\r\\n00100\\r\\n00010\\r\\n00001\\r\\n', 'output': ['6\\r\\n']}, {'input': '5 5\\r\\n10001\\r\\n00100\\r\\n01000\\r\\n01001\\r\\n11111\\r\\n', 'output': ['2\\r\\n']}, {'input': '5 5\\r\\n11111\\r\\n11111\\r\\n11111\\r\\n11111\\r\\n00000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 10\\r\\n0001000100\\r\\n1000001000\\r\\n0001000001\\r\\n0100001010\\r\\n0110100000\\r\\n', 'output': ['5\\r\\n']}, {'input': '6 6\\r\\n111000\\r\\n011100\\r\\n001110\\r\\n000111\\r\\n100011\\r\\n110001\\r\\n', 'output': ['4\\r\\n']}, {'input': '2 9\\r\\n101010101\\r\\n010101010\\r\\n', 'output': ['1\\r\\n']}, {'input': '4 6\\r\\n000001\\r\\n100000\\r\\n100000\\r\\n100000\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 6\\r\\n000010\\r\\n010000\\r\\n000100\\r\\n', 'output': ['3\\r\\n']}, {'input': '4 10\\r\\n0000101010\\r\\n1010101010\\r\\n0101010101\\r\\n0000010100\\r\\n', 'output': ['2\\r\\n']}, {'input': '10 10\\r\\n0000000000\\r\\n0000000010\\r\\n0010000000\\r\\n0111000010\\r\\n1000000000\\r\\n0000000100\\r\\n0000000100\\r\\n0000100100\\r\\n0010000000\\r\\n0000100000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10 10\\r\\n0000000000\\r\\n0000001000\\r\\n0000000100\\r\\n0101000100\\r\\n0000000000\\r\\n0000000000\\r\\n1000110000\\r\\n1011010010\\r\\n0000100000\\r\\n0000001001\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10 10\\r\\n0001001101\\r\\n0010001010\\r\\n1100000000\\r\\n0110110110\\r\\n1011011010\\r\\n1001001001\\r\\n0100010001\\r\\n0110000100\\r\\n0000100000\\r\\n1000010000\\r\\n', 'output': ['8\\r\\n']}, {'input': '10 10\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n1111111111\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 5\\r\\n10000\\r\\n00001\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 7\\r\\n1000000\\r\\n0000010\\r\\n1000000\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 5\\r\\n10010\\r\\n11001\\r\\n00010\\r\\n11000\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 10\\r\\n0000000001\\r\\n1000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '5 5\\r\\n10000\\r\\n10000\\r\\n00001\\r\\n10000\\r\\n10000\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 4\\r\\n0001\\r\\n0001\\r\\n1000\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 6\\r\\n101010\\r\\n000010\\r\\n100000\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 7\\r\\n0100000\\r\\n0100000\\r\\n0000001\\r\\n0000001\\r\\n', 'output': ['4\\r\\n']}, {'input': '5 1\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 5\\r\\n00001\\r\\n10000\\r\\n00001\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 1\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['-1\\r\\n']}]","id":79} {"description":"Peter likes to travel by train. He likes it so much that on the train he falls asleep. Once in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started to look through the window and noticed that every railway station has a flag of a particular colour.The boy started to memorize the order of the flags' colours that he had seen. But soon he fell asleep again. Unfortunately, he didn't sleep long, he woke up and went on memorizing the colours. Then he fell asleep again, and that time he slept till the end of the journey.At the station he told his parents about what he was doing, and wrote two sequences of the colours that he had seen before and after his sleep, respectively.Peter's parents know that their son likes to fantasize. They give you the list of the flags' colours at the stations that the train passes sequentially on the way from A to B, and ask you to find out if Peter could see those sequences on the way from A to B, or from B to A. Remember, please, that Peter had two periods of wakefulness.Peter's parents put lowercase Latin letters for colours. The same letter stands for the same colour, different letters \u2014 for different colours.","input_specification":"The input data contains three lines. The first line contains a non-empty string, whose length does not exceed 105, the string consists of lowercase Latin letters \u2014 the flags' colours at the stations on the way from A to B. On the way from B to A the train passes the same stations, but in reverse order. The second line contains the sequence, written by Peter during the first period of wakefulness. The third line contains the sequence, written during the second period of wakefulness. Both sequences are non-empty, consist of lowercase Latin letters, and the length of each does not exceed 100 letters. Each of the sequences is written in chronological order. ","output_specification":"Output one of the four words without inverted commas: \u00abforward\u00bb \u2014 if Peter could see such sequences only on the way from A to B; \u00abbackward\u00bb \u2014 if Peter could see such sequences on the way from B to A; \u00abboth\u00bb \u2014 if Peter could see such sequences both on the way from A to B, and on the way from B to A; \u00abfantasy\u00bb \u2014 if Peter could not see such sequences. ","notes":"NoteIt is assumed that the train moves all the time, so one flag cannot be seen twice. There are no flags at stations A and B.","sample_inputs":["atob\na\nb","aaacaaa\naca\naa"],"sample_outputs":["forward","both"],"src_uid":"c3244e952830643938d51ce14f043d7d","lang_cluster":"Java","difficulty":1200,"human_solution":"\/**\n * ******* Created on 23\/10\/19 7:01 PM*******\n *\/\n\nimport java.io.*;\nimport java.util.*;\n\npublic class A8 implements Runnable {\n\n private void solve() throws IOException {\n String platform = reader.next();\n String first = reader.next();\n String second = reader.next();\n int n =platform.length();\n String[] output={\"fantasy\",\"forward\", \"backward\", \"both\"};\n int mask =0;\n for(int l=0;l<2;l++){\n boolean flag =false;\n int index = platform.indexOf(first);\n if(index !=-1)\n flag = platform.indexOf(second, index+first.length())!=-1;\n platform = new StringBuilder(platform).reverse().toString();\n if(flag ==true){\n mask |= (1< bob[i]) {\n System.out.print(fail);\n return;\n }\n }\n \n System.out.print(ok);\n }\n}\n\n\/\/ Class for buffered reading int and double values \n\/\/ From: http:\/\/www.cpe.ku.ac.th\/~jim\/java-io.html\nclass Reader {\n static BufferedReader reader;\n static StringTokenizer tokenizer;\n\n \/\/call this method to initialize reader for InputStream\n static void init(InputStream input) {\n reader = new BufferedReader(\n new InputStreamReader(input) );\n tokenizer = new StringTokenizer(\"\");\n }\n\n \/\/get next word\n static String next() throws IOException {\n while ( ! tokenizer.hasMoreTokens() ) {\n \/\/TODO add check for eof if necessary\n tokenizer = new StringTokenizer(\n reader.readLine() );\n }\n return tokenizer.nextToken();\n }\n\n static int nextInt() throws IOException {\n return Integer.parseInt( next() );\n }\n\t\n static double nextDouble() throws IOException {\n return Double.parseDouble( next() );\n }\n}","testcases":"[{'input': '3310\\r\\n1033\\r\\n', 'output': ['OK']}, {'input': '4\\r\\n5\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '40\\r\\n04\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '12\\r\\n12\\r\\n', 'output': ['OK']}, {'input': '432\\r\\n234\\r\\n', 'output': ['OK']}, {'input': '17109\\r\\n01179\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '888\\r\\n888\\r\\n', 'output': ['OK']}, {'input': '912\\r\\n9123\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '0\\r\\n00\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '11110\\r\\n1111\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '7391\\r\\n1397\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '201\\r\\n102\\r\\n', 'output': ['OK']}, {'input': '111111111\\r\\n111111111\\r\\n', 'output': ['OK']}, {'input': '32352320\\r\\n22203335\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '1000000000\\r\\n1\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '994321\\r\\n123499\\r\\n', 'output': ['OK']}, {'input': '10101\\r\\n10101\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '666\\r\\n0666\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '2\\r\\n02\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '313\\r\\n133\\r\\n', 'output': ['OK']}, {'input': '987235645\\r\\n234556789\\r\\n', 'output': ['OK']}, {'input': '90812\\r\\n010289\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '123\\r\\n321\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '707\\r\\n770\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '77774444\\r\\n47474747\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '1270\\r\\n1027\\r\\n', 'output': ['OK']}, {'input': '320\\r\\n23\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '123456789\\r\\n123456789\\r\\n', 'output': ['OK']}, {'input': '918273645\\r\\n546372819\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '300000003\\r\\n30000003\\r\\n', 'output': ['WRONG_ANSWER']}, {'input': '0\\r\\n0\\r\\n', 'output': ['OK']}, {'input': '0\\r\\n7\\r\\n', 'output': ['WRONG_ANSWER']}]","id":81} {"description":"A new cottage village called \u00abFlatville\u00bb is being built in Flatland. By now they have already built in \u00abFlatville\u00bb n square houses with the centres on the \u041ex-axis. The houses' sides are parallel to the coordinate axes. It's known that no two houses overlap, but they can touch each other.The architect bureau, where Peter works, was commissioned to build a new house in \u00abFlatville\u00bb. The customer wants his future house to be on the \u041ex-axis, to be square in shape, have a side t, and touch at least one of the already built houses. For sure, its sides should be parallel to the coordinate axes, its centre should be on the Ox-axis and it shouldn't overlap any of the houses in the village.Peter was given a list of all the houses in \u00abFlatville\u00bb. Would you help him find the amount of possible positions of the new house?","input_specification":"The first line of the input data contains numbers n and t (1\u2009\u2264\u2009n,\u2009t\u2009\u2264\u20091000). Then there follow n lines, each of them contains two space-separated integer numbers: xi ai, where xi \u2014 x-coordinate of the centre of the i-th house, and ai \u2014 length of its side (\u2009-\u20091000\u2009\u2264\u2009xi\u2009\u2264\u20091000, 1\u2009\u2264\u2009ai\u2009\u2264\u20091000).","output_specification":"Output the amount of possible positions of the new house.","notes":"NoteIt is possible for the x-coordinate of the new house to have non-integer value.","sample_inputs":["2 2\n0 4\n6 2","2 2\n0 4\n5 2","2 3\n0 4\n5 2"],"sample_outputs":["4","3","2"],"src_uid":"c31fed523230af1f904218b2fe0d663d","lang_cluster":"Java","difficulty":1200,"human_solution":"import java.util.*;\n\npublic class Trying\n{\n public static void main (String[] args) \n {\n Scanner enter = new Scanner(System.in);\n int n = enter.nextInt(), t = enter.nextInt(), pos = 0;\n double available[] = new double[n*2], xa[][] = new double [n][2],\n max = 0;\n for(int i = 0 ; i < n ; i++)\n for(int j = 0 ; j < 2 ; j++)\n xa[i][j] = enter.nextInt();\n max = 1 ;\n while(max != 1001)\n {\n max = 1001;\n for(int i = 0 ; i < n-1 ; i++)\n {\n if(xa[i][0] > xa[i+1][0])\n {\n max = xa[i][0];\n xa[i][0] = xa[i+1][0];\n xa[i+1][0] = max ;\n max = xa[i][1];\n xa[i][1] = xa[i+1][1];\n xa[i+1][1] = max ;\n }\n }\n }\n for(int i = 0 ; i < n ; i++)\n {\n available[pos] = xa[i][0] - xa[i][1]\/2;\n pos++;\n available[pos] = xa[i][1]\/2 + xa[i][0];\n pos++;\n }\n max = 0;\n for(int i = 1 ; i <= 2*n-2 ; i+=2)\n {\n if(available[i+1] - available[i] > t)\n max+=2;\n else if(available[i+1] - available[i] == t)\n max++;\n }\n System.out.println((int)max+2);\n }\n}","testcases":"[{'input': '2 2\\r\\n0 4\\r\\n6 2\\r\\n', 'output': ['4\\r\\n']}, {'input': '2 2\\r\\n0 4\\r\\n5 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 3\\r\\n0 4\\r\\n5 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 2\\r\\n2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 1\\r\\n2 1\\r\\n1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 2\\r\\n0 4\\r\\n7 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '4 1\\r\\n-12 1\\r\\n-14 1\\r\\n4 1\\r\\n-11 1\\r\\n', 'output': ['5\\r\\n']}, {'input': '6 15\\r\\n19 1\\r\\n2 3\\r\\n6 2\\r\\n-21 2\\r\\n-15 2\\r\\n23 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '10 21\\r\\n-61 6\\r\\n55 2\\r\\n-97 1\\r\\n37 1\\r\\n-39 1\\r\\n26 2\\r\\n21 1\\r\\n64 3\\r\\n-68 1\\r\\n-28 6\\r\\n', 'output': ['6\\r\\n']}, {'input': '26 51\\r\\n783 54\\r\\n-850 6\\r\\n-997 59\\r\\n573 31\\r\\n-125 20\\r\\n472 52\\r\\n101 5\\r\\n-561 4\\r\\n625 35\\r\\n911 14\\r\\n-47 33\\r\\n677 55\\r\\n-410 54\\r\\n13 53\\r\\n173 31\\r\\n968 30\\r\\n-497 7\\r\\n832 42\\r\\n271 59\\r\\n-638 52\\r\\n-301 51\\r\\n378 36\\r\\n-813 7\\r\\n-206 22\\r\\n-737 37\\r\\n-911 9\\r\\n', 'output': ['35\\r\\n']}, {'input': '14 101\\r\\n121 88\\r\\n-452 91\\r\\n635 28\\r\\n-162 59\\r\\n-872 26\\r\\n-996 8\\r\\n468 86\\r\\n742 63\\r\\n892 89\\r\\n-249 107\\r\\n300 51\\r\\n-753 17\\r\\n-620 31\\r\\n-13 34\\r\\n', 'output': ['16\\r\\n']}, {'input': '3 501\\r\\n827 327\\r\\n-85 480\\r\\n-999 343\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 999\\r\\n-999 471\\r\\n530 588\\r\\n', 'output': ['4\\r\\n']}, {'input': '22 54\\r\\n600 43\\r\\n806 19\\r\\n-269 43\\r\\n-384 78\\r\\n222 34\\r\\n392 10\\r\\n318 30\\r\\n488 73\\r\\n-756 49\\r\\n-662 22\\r\\n-568 50\\r\\n-486 16\\r\\n-470 2\\r\\n96 66\\r\\n864 16\\r\\n934 15\\r\\n697 43\\r\\n-154 30\\r\\n775 5\\r\\n-876 71\\r\\n-33 78\\r\\n-991 31\\r\\n', 'output': ['30\\r\\n']}, {'input': '17 109\\r\\n52 7\\r\\n216 24\\r\\n-553 101\\r\\n543 39\\r\\n391 92\\r\\n-904 67\\r\\n95 34\\r\\n132 14\\r\\n730 103\\r\\n952 118\\r\\n-389 41\\r\\n-324 36\\r\\n-74 2\\r\\n-147 99\\r\\n-740 33\\r\\n233 1\\r\\n-995 3\\r\\n', 'output': ['16\\r\\n']}, {'input': '4 512\\r\\n-997 354\\r\\n-568 216\\r\\n-234 221\\r\\n603 403\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 966\\r\\n988 5\\r\\n15 2\\r\\n-992 79\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 1000\\r\\n-995 201\\r\\n206 194\\r\\n', 'output': ['4\\r\\n']}, {'input': '50 21\\r\\n-178 1\\r\\n49 1\\r\\n-98 1\\r\\n-220 1\\r\\n152 1\\r\\n-160 3\\r\\n17 2\\r\\n77 1\\r\\n-24 1\\r\\n214 2\\r\\n-154 2\\r\\n-141 1\\r\\n79 1\\r\\n206 1\\r\\n8 1\\r\\n-208 1\\r\\n36 1\\r\\n231 3\\r\\n-2 2\\r\\n-130 2\\r\\n-14 2\\r\\n34 1\\r\\n-187 2\\r\\n14 1\\r\\n-83 2\\r\\n-241 1\\r\\n149 2\\r\\n73 1\\r\\n-233 3\\r\\n-45 1\\r\\n197 1\\r\\n145 2\\r\\n-127 2\\r\\n-229 4\\r\\n-85 1\\r\\n-66 1\\r\\n-76 2\\r\\n104 1\\r\\n175 1\\r\\n70 1\\r\\n131 3\\r\\n-108 1\\r\\n-5 4\\r\\n140 1\\r\\n33 1\\r\\n248 3\\r\\n-36 3\\r\\n134 1\\r\\n-183 1\\r\\n56 2\\r\\n', 'output': ['9\\r\\n']}, {'input': '50 1\\r\\n37 1\\r\\n-38 1\\r\\n7 1\\r\\n47 1\\r\\n-4 1\\r\\n24 1\\r\\n-32 1\\r\\n-23 1\\r\\n-3 1\\r\\n-19 1\\r\\n5 1\\r\\n-50 1\\r\\n11 1\\r\\n-11 1\\r\\n49 1\\r\\n-39 1\\r\\n0 1\\r\\n43 1\\r\\n-10 1\\r\\n6 1\\r\\n19 1\\r\\n1 1\\r\\n27 1\\r\\n29 1\\r\\n-47 1\\r\\n-40 1\\r\\n-46 1\\r\\n-26 1\\r\\n-42 1\\r\\n-37 1\\r\\n13 1\\r\\n-29 1\\r\\n-30 1\\r\\n3 1\\r\\n44 1\\r\\n10 1\\r\\n4 1\\r\\n-14 1\\r\\n-2 1\\r\\n34 1\\r\\n18 1\\r\\n-33 1\\r\\n-44 1\\r\\n9 1\\r\\n-36 1\\r\\n-7 1\\r\\n25 1\\r\\n22 1\\r\\n-20 1\\r\\n-41 1\\r\\n', 'output': ['43\\r\\n']}, {'input': '50 1\\r\\n-967 7\\r\\n696 7\\r\\n-366 4\\r\\n557 1\\r\\n978 2\\r\\n800 4\\r\\n-161 2\\r\\n-773 2\\r\\n-248 2\\r\\n134 3\\r\\n869 6\\r\\n-932 2\\r\\n-262 14\\r\\n191 3\\r\\n669 2\\r\\n72 5\\r\\n0 1\\r\\n757 8\\r\\n859 2\\r\\n-131 8\\r\\n-169 3\\r\\n543 10\\r\\n-120 2\\r\\n-87 8\\r\\n-936 6\\r\\n-620 3\\r\\n-281 11\\r\\n684 3\\r\\n886 10\\r\\n497 4\\r\\n380 4\\r\\n833 1\\r\\n-727 6\\r\\n470 11\\r\\n584 9\\r\\n66 6\\r\\n-609 12\\r\\n-661 4\\r\\n-57 8\\r\\n628 7\\r\\n635 4\\r\\n-924 3\\r\\n-982 4\\r\\n-201 7\\r\\n-9 8\\r\\n-560 9\\r\\n712 7\\r\\n-330 8\\r\\n-191 1\\r\\n-892 7\\r\\n', 'output': ['96\\r\\n']}, {'input': '1 1000\\r\\n0 1000\\r\\n', 'output': ['2\\r\\n']}]","id":82} {"description":"A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in the i-th container there are ai matchboxes, and each matchbox contains bi matches. All the matchboxes are of the same size. The burglar's rucksack can hold n matchboxes exactly. Your task is to find out the maximum amount of matches that a burglar can carry away. He has no time to rearrange matches in the matchboxes, that's why he just chooses not more than n matchboxes so that the total amount of matches in them is maximal.","input_specification":"The first line of the input contains integer n (1\u2009\u2264\u2009n\u2009\u2264\u20092\u00b7108) and integer m (1\u2009\u2264\u2009m\u2009\u2264\u200920). The i\u2009+\u20091-th line contains a pair of numbers ai and bi (1\u2009\u2264\u2009ai\u2009\u2264\u2009108,\u20091\u2009\u2264\u2009bi\u2009\u2264\u200910). All the input numbers are integer.","output_specification":"Output the only number \u2014 answer to the problem.","notes":null,"sample_inputs":["7 3\n5 10\n2 5\n3 6","3 3\n1 3\n2 2\n3 1"],"sample_outputs":["62","7"],"src_uid":"c052d85e402691b05e494b5283d62679","lang_cluster":"Java","difficulty":900,"human_solution":"\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport static java.util.Collections.reverseOrder;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Scanner;\nimport java.util.Set;\nimport java.util.stream.Collectors;\n\n\/**\n *\n * @author Ahmed_Naser\n *\/\npublic class HelloWorld {\n\n \n \n public static void main(String[] args) {\n Scanner in=new Scanner(System.in);\n int n = in.nextInt();\n int m = in.nextInt();\n \n int matchboxes[] = new int[m];\n int matches[]= new int[m];\n \n for(int i = 0 ; i < m ; i++)\n {\n matchboxes[i] =in.nextInt();\n matches[i] = in.nextInt();\n }\n \n \n int max = matches[0];\n int index = 0 ; \n int count = 0 ;\n while( n > 0)\n {\n \n for( int j = 0 ; j < m ; ++j)\n {\n if( matches[j] >= max)\n {\n max= matches[j]; \n index = j;\n \n } \n } \n if( matchboxes[index] <= n)\n {\n n = n - matchboxes[index];\n count = count + (matches[index] * matchboxes[index] ); \n matches[index] = 0 ;\n }\n else\n {\n \n count = count + (n * matches[index]);\n n = 0 ;\n }\n max = matches[0];\n }\n \n System.out.println(count);\n \n }\n}\n","testcases":"[{'input': '7 3\\r\\n5 10\\r\\n2 5\\r\\n3 6\\r\\n', 'output': ['62']}, {'input': '3 3\\r\\n1 3\\r\\n2 2\\r\\n3 1\\r\\n', 'output': ['7']}, {'input': '1 1\\r\\n1 2\\r\\n', 'output': ['2']}, {'input': '1 2\\r\\n1 9\\r\\n1 6\\r\\n', 'output': ['9']}, {'input': '1 10\\r\\n1 1\\r\\n1 9\\r\\n1 3\\r\\n1 9\\r\\n1 7\\r\\n1 10\\r\\n1 4\\r\\n1 7\\r\\n1 3\\r\\n1 1\\r\\n', 'output': ['10']}, {'input': '2 1\\r\\n2 1\\r\\n', 'output': ['2']}, {'input': '2 2\\r\\n2 4\\r\\n1 4\\r\\n', 'output': ['8']}, {'input': '2 3\\r\\n1 7\\r\\n1 2\\r\\n1 5\\r\\n', 'output': ['12']}, {'input': '4 1\\r\\n2 2\\r\\n', 'output': ['4']}, {'input': '4 2\\r\\n1 10\\r\\n4 4\\r\\n', 'output': ['22']}, {'input': '4 3\\r\\n1 4\\r\\n6 4\\r\\n1 7\\r\\n', 'output': ['19']}, {'input': '5 1\\r\\n10 5\\r\\n', 'output': ['25']}, {'input': '5 2\\r\\n3 9\\r\\n2 2\\r\\n', 'output': ['31']}, {'input': '5 5\\r\\n2 9\\r\\n3 1\\r\\n2 1\\r\\n1 8\\r\\n2 8\\r\\n', 'output': ['42']}, {'input': '5 10\\r\\n1 3\\r\\n1 2\\r\\n1 9\\r\\n1 10\\r\\n1 1\\r\\n1 5\\r\\n1 10\\r\\n1 2\\r\\n1 3\\r\\n1 7\\r\\n', 'output': ['41']}, {'input': '10 1\\r\\n9 4\\r\\n', 'output': ['36']}, {'input': '10 2\\r\\n14 3\\r\\n1 3\\r\\n', 'output': ['30']}, {'input': '10 7\\r\\n4 8\\r\\n1 10\\r\\n1 10\\r\\n1 2\\r\\n3 3\\r\\n1 3\\r\\n1 10\\r\\n', 'output': ['71']}, {'input': '10 10\\r\\n1 8\\r\\n2 10\\r\\n1 9\\r\\n1 1\\r\\n1 9\\r\\n1 6\\r\\n1 4\\r\\n2 5\\r\\n1 2\\r\\n1 4\\r\\n', 'output': ['70']}, {'input': '10 4\\r\\n1 5\\r\\n5 2\\r\\n1 9\\r\\n3 3\\r\\n', 'output': ['33']}, {'input': '100 5\\r\\n78 6\\r\\n29 10\\r\\n3 6\\r\\n7 3\\r\\n2 4\\r\\n', 'output': ['716']}, {'input': '1000 7\\r\\n102 10\\r\\n23 6\\r\\n79 4\\r\\n48 1\\r\\n34 10\\r\\n839 8\\r\\n38 4\\r\\n', 'output': ['8218']}, {'input': '10000 10\\r\\n336 2\\r\\n2782 5\\r\\n430 10\\r\\n1893 7\\r\\n3989 10\\r\\n2593 8\\r\\n165 6\\r\\n1029 2\\r\\n2097 4\\r\\n178 10\\r\\n', 'output': ['84715']}, {'input': '100000 3\\r\\n2975 2\\r\\n35046 4\\r\\n61979 9\\r\\n', 'output': ['703945']}, {'input': '1000000 4\\r\\n314183 9\\r\\n304213 4\\r\\n16864 5\\r\\n641358 9\\r\\n', 'output': ['8794569']}, {'input': '10000000 10\\r\\n360313 10\\r\\n416076 1\\r\\n435445 9\\r\\n940322 7\\r\\n1647581 7\\r\\n4356968 10\\r\\n3589256 2\\r\\n2967933 5\\r\\n2747504 7\\r\\n1151633 3\\r\\n', 'output': ['85022733']}, {'input': '100000000 7\\r\\n32844337 7\\r\\n11210848 7\\r\\n47655987 1\\r\\n33900472 4\\r\\n9174763 2\\r\\n32228738 10\\r\\n29947408 5\\r\\n', 'output': ['749254060']}, {'input': '200000000 10\\r\\n27953106 7\\r\\n43325979 4\\r\\n4709522 1\\r\\n10975786 4\\r\\n67786538 8\\r\\n48901838 7\\r\\n15606185 6\\r\\n2747583 1\\r\\n100000000 1\\r\\n633331 3\\r\\n', 'output': ['1332923354']}, {'input': '200000000 9\\r\\n17463897 9\\r\\n79520463 1\\r\\n162407 4\\r\\n41017993 8\\r\\n71054118 4\\r\\n9447587 2\\r\\n5298038 9\\r\\n3674560 7\\r\\n20539314 5\\r\\n', 'output': ['996523209']}, {'input': '200000000 8\\r\\n6312706 6\\r\\n2920548 2\\r\\n16843192 3\\r\\n1501141 2\\r\\n13394704 6\\r\\n10047725 10\\r\\n4547663 6\\r\\n54268518 6\\r\\n', 'output': ['630991750']}, {'input': '200000000 7\\r\\n25621043 2\\r\\n21865270 1\\r\\n28833034 1\\r\\n22185073 5\\r\\n100000000 2\\r\\n13891017 9\\r\\n61298710 8\\r\\n', 'output': ['931584598']}, {'input': '200000000 6\\r\\n7465600 6\\r\\n8453505 10\\r\\n4572014 8\\r\\n8899499 3\\r\\n86805622 10\\r\\n64439238 6\\r\\n', 'output': ['1447294907']}, {'input': '200000000 5\\r\\n44608415 6\\r\\n100000000 9\\r\\n51483223 9\\r\\n44136047 1\\r\\n52718517 1\\r\\n', 'output': ['1634907859']}, {'input': '200000000 4\\r\\n37758556 10\\r\\n100000000 6\\r\\n48268521 3\\r\\n20148178 10\\r\\n', 'output': ['1305347138']}, {'input': '200000000 3\\r\\n65170000 7\\r\\n20790088 1\\r\\n74616133 4\\r\\n', 'output': ['775444620']}, {'input': '200000000 2\\r\\n11823018 6\\r\\n100000000 9\\r\\n', 'output': ['970938108']}, {'input': '200000000 1\\r\\n100000000 6\\r\\n', 'output': ['600000000']}, {'input': '200000000 10\\r\\n12097724 9\\r\\n41745972 5\\r\\n26982098 9\\r\\n14916995 7\\r\\n21549986 7\\r\\n3786630 9\\r\\n8050858 7\\r\\n27994924 4\\r\\n18345001 5\\r\\n8435339 5\\r\\n', 'output': ['1152034197']}, {'input': '200000000 10\\r\\n55649 8\\r\\n10980981 9\\r\\n3192542 8\\r\\n94994808 4\\r\\n3626106 1\\r\\n100000000 6\\r\\n5260110 9\\r\\n4121453 2\\r\\n15125061 4\\r\\n669569 6\\r\\n', 'output': ['1095537357']}, {'input': '10 20\\r\\n1 7\\r\\n1 7\\r\\n1 8\\r\\n1 3\\r\\n1 10\\r\\n1 7\\r\\n1 7\\r\\n1 9\\r\\n1 3\\r\\n1 1\\r\\n1 2\\r\\n1 1\\r\\n1 3\\r\\n1 10\\r\\n1 9\\r\\n1 8\\r\\n1 8\\r\\n1 6\\r\\n1 7\\r\\n1 5\\r\\n', 'output': ['83']}, {'input': '10000000 20\\r\\n4594 7\\r\\n520836 8\\r\\n294766 6\\r\\n298672 4\\r\\n142253 6\\r\\n450626 1\\r\\n1920034 9\\r\\n58282 4\\r\\n1043204 1\\r\\n683045 1\\r\\n1491746 5\\r\\n58420 4\\r\\n451217 2\\r\\n129423 4\\r\\n246113 5\\r\\n190612 8\\r\\n912923 6\\r\\n473153 6\\r\\n783733 6\\r\\n282411 10\\r\\n', 'output': ['54980855']}, {'input': '200000000 20\\r\\n15450824 5\\r\\n839717 10\\r\\n260084 8\\r\\n1140850 8\\r\\n28744 6\\r\\n675318 3\\r\\n25161 2\\r\\n5487 3\\r\\n6537698 9\\r\\n100000000 5\\r\\n7646970 9\\r\\n16489 6\\r\\n24627 3\\r\\n1009409 5\\r\\n22455 1\\r\\n25488456 4\\r\\n484528 9\\r\\n32663641 3\\r\\n750968 4\\r\\n5152 6\\r\\n', 'output': ['939368573']}, {'input': '200000000 20\\r\\n16896 2\\r\\n113 3\\r\\n277 2\\r\\n299 7\\r\\n69383562 2\\r\\n3929 8\\r\\n499366 4\\r\\n771846 5\\r\\n9 4\\r\\n1278173 7\\r\\n90 2\\r\\n54 7\\r\\n72199858 10\\r\\n17214 5\\r\\n3 10\\r\\n1981618 3\\r\\n3728 2\\r\\n141 8\\r\\n2013578 9\\r\\n51829246 5\\r\\n', 'output': ['1158946383']}, {'input': '200000000 20\\r\\n983125 2\\r\\n7453215 9\\r\\n9193588 2\\r\\n11558049 7\\r\\n28666199 1\\r\\n34362244 1\\r\\n5241493 5\\r\\n15451270 4\\r\\n19945845 8\\r\\n6208681 3\\r\\n38300385 7\\r\\n6441209 8\\r\\n21046742 7\\r\\n577198 10\\r\\n3826434 8\\r\\n9764276 8\\r\\n6264675 7\\r\\n8567063 3\\r\\n3610303 4\\r\\n2908232 3\\r\\n', 'output': ['1131379312']}, {'input': '10 15\\r\\n1 6\\r\\n2 6\\r\\n3 4\\r\\n1 3\\r\\n1 2\\r\\n1 5\\r\\n1 6\\r\\n1 2\\r\\n2 9\\r\\n1 10\\r\\n1 3\\r\\n1 7\\r\\n1 8\\r\\n1 2\\r\\n2 9\\r\\n', 'output': ['79']}, {'input': '10000000 15\\r\\n111 5\\r\\n914124 3\\r\\n3 9\\r\\n177790 1\\r\\n2352 3\\r\\n32138 9\\r\\n104477 1\\r\\n1223 4\\r\\n18 6\\r\\n6655580 4\\r\\n57643 10\\r\\n94309 2\\r\\n37 1\\r\\n227002 10\\r\\n1733193 7\\r\\n', 'output': ['45116295']}, {'input': '200000000 15\\r\\n7069868 1\\r\\n5567826 8\\r\\n2310059 10\\r\\n13539782 7\\r\\n38420939 4\\r\\n29911411 8\\r\\n52256316 1\\r\\n12265839 9\\r\\n2074265 1\\r\\n24896428 9\\r\\n72470695 5\\r\\n3236301 1\\r\\n3890243 2\\r\\n65168965 8\\r\\n65724 6\\r\\n', 'output': ['1489289257']}, {'input': '200000000 15\\r\\n12044094 7\\r\\n2475138 10\\r\\n944451 7\\r\\n4854766 2\\r\\n3809145 10\\r\\n7727571 2\\r\\n43908937 6\\r\\n2745883 1\\r\\n427511 2\\r\\n100000000 5\\r\\n190914 6\\r\\n554889 3\\r\\n288798 4\\r\\n1848572 5\\r\\n893874 3\\r\\n', 'output': ['961871671']}, {'input': '200000000 15\\r\\n6334191 7\\r\\n1927941 4\\r\\n5175933 10\\r\\n468389 1\\r\\n433043 10\\r\\n6863198 5\\r\\n7480646 4\\r\\n14774279 10\\r\\n2921129 8\\r\\n18325627 7\\r\\n6973152 9\\r\\n8277324 9\\r\\n21522856 2\\r\\n2058070 1\\r\\n2444742 4\\r\\n', 'output': ['664376069']}]","id":83} {"description":"Once Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics of the given sequence. In other words it is the smallest element strictly greater than the minimum. Help Bob solve this problem.","input_specification":"The first input line contains integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of numbers in the sequence. The second line contains n space-separated integer numbers \u2014 elements of the sequence. These numbers don't exceed 100 in absolute value.","output_specification":"If the given sequence has the second order statistics, output this order statistics, otherwise output NO.","notes":null,"sample_inputs":["4\n1 2 2 -4","5\n1 2 3 1 1"],"sample_outputs":["1","2"],"src_uid":"930be5ec102fbe062062aa23eac75187","lang_cluster":"Java","difficulty":800,"human_solution":"import java.util.Scanner;\n\npublic class CF2 {\n\tpublic static void main (String [] args ) {\n\t\tScanner mos = new Scanner ( System.in ) ;\n\t\tint a = mos.nextInt () ;\n\t\tint c = 0 ;\n\t\tint temp ;\n\t\tint [] b = new int [a] ;\n\t\tfor ( int i = 0 ; i < b.length ; i ++ )\n\t\t\tb [i] = mos.nextInt();\n\t\tfor ( int i = 0 ; i < b.length ; i++ )\n\t\t\tfor ( int j = 0 ; j < i ; j ++ ){\n\t\t\t\tif ( b [ i ] < b [ j ]){\n\t\t\t\t\ttemp = b[i] ;\n\t\t\t\t\tb[i] = b[j] ;\n\t\t\t\t\tb[j] = temp ;\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\tfor ( int i = 1 ; i < b.length ; i++ ){\n\t\t\tfor ( int j = 0 ; j < i ; j ++ )\n\t\t\t\tif ( b[i] == b[j]){\n\t\t\t\t\tc ++ ;\n\t\t\t\t}\n\t\t\tif ( c == 0 ){\n\t\t\t\tSystem.out.println( b[i] );\n\t\t\t\tc++ ;\n\t\t\t\tbreak ;\n\t\t\t\t\n\t\t\t}\n\t\t\tc = 0 ;\n\t\t\t\t\n\t\t}\n\t\tif ( c == 0 || b.length <= 1 )\n\t\t\tSystem.out.println(\"NO\");\n\t}\n\n}\n","testcases":"[{'input': '4\\r\\n1 2 2 -4\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 2 3 1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n28\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2\\r\\n-28 12\\r\\n', 'output': ['12\\r\\n']}, {'input': '3\\r\\n-83 40 -80\\r\\n', 'output': ['-80\\r\\n']}, {'input': '8\\r\\n93 77 -92 26 21 -48 53 91\\r\\n', 'output': ['-48\\r\\n']}, {'input': '20\\r\\n-72 -9 -86 80 7 -10 40 -27 -94 92 96 56 28 -19 79 36 -3 -73 -63 -49\\r\\n', 'output': ['-86\\r\\n']}, {'input': '49\\r\\n-74 -100 -80 23 -8 -83 -41 -20 48 17 46 -73 -55 67 85 4 40 -60 -69 -75 56 -74 -42 93 74 -95 64 -46 97 -47 55 0 -78 -34 -31 40 -63 -49 -76 48 21 -1 -49 -29 -98 -11 76 26 94\\r\\n', 'output': ['-98\\r\\n']}, {'input': '88\\r\\n63 48 1 -53 -89 -49 64 -70 -49 71 -17 -16 76 81 -26 -50 67 -59 -56 97 2 100 14 18 -91 -80 42 92 -25 -88 59 8 -56 38 48 -71 -78 24 -14 48 -1 69 73 -76 54 16 -92 44 47 33 -34 -17 -81 21 -59 -61 53 26 10 -76 67 35 -29 70 65 -13 -29 81 80 32 74 -6 34 46 57 1 -45 -55 69 79 -58 11 -2 22 -18 -16 -89 -46\\r\\n', 'output': ['-91\\r\\n']}, {'input': '100\\r\\n34 32 88 20 76 53 -71 -39 -98 -10 57 37 63 -3 -54 -64 -78 -82 73 20 -30 -4 22 75 51 -64 -91 29 -52 -48 83 19 18 -47 46 57 -44 95 89 89 -30 84 -83 67 58 -99 -90 -53 92 -60 -5 -56 -61 27 68 -48 52 -95 64 -48 -30 -67 66 89 14 -33 -31 -91 39 7 -94 -54 92 -96 -99 -83 -16 91 -28 -66 81 44 14 -85 -21 18 40 16 -13 -82 -33 47 -10 -40 -19 10 25 60 -34 -89\\r\\n', 'output': ['-98\\r\\n']}, {'input': '2\\r\\n-1 -1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3\\r\\n-2 -2 -2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '100\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '100\\r\\n100 100 100 100 100 100 100 100 100 100 100 100 -100 100 100 100 100 100 100 100 100 100 100 100 -100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 -100 100 100 100 100 100 100 100 100 100 100 -100 100 100 100 100 -100 100 100 100 100 100 100 100 100 100 100 100\\r\\n', 'output': ['100\\r\\n']}, {'input': '10\\r\\n40 71 -85 -85 40 -85 -85 64 -85 47\\r\\n', 'output': ['40\\r\\n']}, {'input': '23\\r\\n-90 -90 -41 -64 -64 -90 -15 10 -43 -90 -64 -64 89 -64 36 47 38 -90 -64 -90 -90 68 -90\\r\\n', 'output': ['-64\\r\\n']}, {'input': '39\\r\\n-97 -93 -42 -93 -97 -93 56 -97 -97 -97 76 -33 -60 91 7 82 17 47 -97 -97 -93 73 -97 12 -97 -97 -97 -97 56 -92 -83 -93 -93 49 -93 -97 -97 -17 -93\\r\\n', 'output': ['-93\\r\\n']}, {'input': '51\\r\\n-21 6 -35 -98 -86 -98 -86 -43 -65 32 -98 -40 96 -98 -98 -98 -98 -86 -86 -98 56 -86 -98 -98 -30 -98 -86 -31 -98 -86 -86 -86 -86 -30 96 -86 -86 -86 -60 25 88 -86 -86 58 31 -47 57 -86 37 44 -83\\r\\n', 'output': ['-86\\r\\n']}, {'input': '66\\r\\n-14 -95 65 -95 -95 -97 -90 -71 -97 -97 70 -95 -95 -97 -95 -27 35 -87 -95 -5 -97 -97 87 34 -49 -95 -97 -95 -97 -95 -30 -95 -97 47 -95 -17 -97 -95 -97 -69 51 -97 -97 -95 -75 87 59 21 63 56 76 -91 98 -97 6 -97 -95 -95 -97 -73 11 -97 -35 -95 -95 -43\\r\\n', 'output': ['-95\\r\\n']}, {'input': '77\\r\\n-67 -93 -93 -92 97 29 93 -93 -93 -5 -93 -7 60 -92 -93 44 -84 68 -92 -93 69 -92 -37 56 43 -93 35 -92 -93 19 -79 18 -92 -93 -93 -37 -93 -47 -93 -92 -92 74 67 19 40 -92 -92 -92 -92 -93 -93 -41 -93 -92 -93 -93 -92 -93 51 -80 6 -42 -92 -92 -66 -12 -92 -92 -3 93 -92 -49 -93 40 62 -92 -92\\r\\n', 'output': ['-92\\r\\n']}, {'input': '89\\r\\n-98 40 16 -87 -98 63 -100 55 -96 -98 -21 -100 -93 26 -98 -98 -100 -89 -98 -5 -65 -28 -100 -6 -66 67 -100 -98 -98 10 -98 -98 -70 7 -98 2 -100 -100 -98 25 -100 -100 -98 23 -68 -100 -98 3 98 -100 -98 -98 -98 -98 -24 -100 -100 -9 -98 35 -100 99 -5 -98 -100 -100 37 -100 -84 57 -98 40 -47 -100 -1 -92 -76 -98 -98 -100 -100 -100 -63 30 21 -100 -100 -100 -12\\r\\n', 'output': ['-98\\r\\n']}, {'input': '99\\r\\n10 -84 -100 -100 73 -64 -100 -94 33 -100 -100 -100 -100 71 64 24 7 -100 -32 -100 -100 77 -100 62 -12 55 45 -100 -100 -80 -100 -100 -100 -100 -100 -100 -100 -100 -100 -39 -48 -100 -34 47 -100 -100 -100 -100 -100 -77 -100 -100 -100 -100 -100 -100 -52 40 -55 -100 -44 -100 72 33 70 -100 -100 -78 -100 -3 100 -77 22 -100 95 -30 -100 10 -69 -100 -100 -100 -100 52 -39 -100 -100 -100 7 -100 -98 -66 95 -17 -100 52 -100 68 -100\\r\\n', 'output': ['-98\\r\\n']}, {'input': '100\\r\\n-99 -98 -64 89 53 57 -99 29 -78 18 -3 -54 76 -98 -99 -98 37 -98 19 -47 89 73 -98 -91 -99 -99 -98 -48 -99 22 -99 -98 -99 -99 -98 -60 84 67 -99 -98 20 -98 88 -98 46 -98 -99 -98 -99 -71 -99 -98 -98 -39 83 95 -98 63 -98 -99 32 -98 -99 -64 57 -30 -53 -83 -4 -99 58 20 -98 -10 -99 -44 -99 -99 -99 -99 75 34 -98 -52 -98 -30 -98 -99 -98 -98 51 -99 -99 -99 -98 -99 -99 -82 -90 92\\r\\n', 'output': ['-98\\r\\n']}, {'input': '3\\r\\n1 2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n1 3 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n2 1 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n2 3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n3 1 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n3 2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '9\\r\\n99 99 99 99 100 100 100 100 100\\r\\n', 'output': ['100\\r\\n']}, {'input': '5\\r\\n-100 -100 -100 -100 -100\\r\\n', 'output': ['NO\\r\\n']}]","id":84} {"description":"Meg the Rabbit decided to do something nice, specifically \u2014 to determine the shortest distance between two points on the surface of our planet. But Meg... what can you say, she wants everything simple. So, she already regards our planet as a two-dimensional circle. No, wait, it's even worse \u2014 as a square of side n. Thus, the task has been reduced to finding the shortest path between two dots on a square (the path should go through the square sides). To simplify the task let us consider the vertices of the square to lie at points whose coordinates are: (0,\u20090), (n,\u20090), (0,\u2009n) and (n,\u2009n).","input_specification":"The single line contains 5 space-separated integers: n,\u2009x1,\u2009y1,\u2009x2,\u2009y2 (1\u2009\u2264\u2009n\u2009\u2264\u20091000,\u20090\u2009\u2264\u2009x1,\u2009y1,\u2009x2,\u2009y2\u2009\u2264\u2009n) which correspondingly represent a side of the square, the coordinates of the first point and the coordinates of the second point. It is guaranteed that the points lie on the sides of the square.","output_specification":"You must print on a single line the shortest distance between the points.","notes":null,"sample_inputs":["2 0 0 1 0","2 0 1 2 1","100 0 0 100 100"],"sample_outputs":["1","4","200"],"src_uid":"685fe16c217b5b71eafdb4198822250e","lang_cluster":"Java","difficulty":1300,"human_solution":"import java.util.*;\nimport java.io.*;\n\npublic class Main {\n \tpublic static void main(String[] args){\n\t\tFastScanner scanner = new FastScanner();\n\t\tint n = scanner.nextInt();\n\t\tint x1 = scanner.nextInt();\n\t\tint y1 = scanner.nextInt();\n\t\tint x2 = scanner.nextInt();\n\t\tint y2 = scanner.nextInt();\n\t\tint min = 10000;\n\t\tif((x1 == 0 && x2 == n) || (x1 == n && x2 == 0)){\n\t\t\tmin = Math.min(min, y1+y2+n);\n\t\t\tmin = Math.min(min, 3*n-y1-y2);\n\t\t}else if((y1 == 0 && y2 == n) || (y1 == n && y2 == 0)){\n\t\t\tmin = Math.min(min, n+x1+x2);\n\t\t\tmin = Math.min(min, 3*n-x1-x2);\n\t\t}else if(y1 == 0 && x2 == n){\n\t\t\tmin = Math.min(min, n-x1+y2);\n\t\t}else if(y2 == 0 && x1 == n){\n\t\t\tmin = Math.min(min,n-x2+y1);\n\t\t}else if(x1 == 0 && y2 == 0){\n\t\t\tmin = Math.min(min,x2+y1);\n\t\t}else if(x2 == 0 && y1 == 0){\n\t\t\tmin = Math.min(min,y2+x1);\n\t\t}else if(x1 == 0 && y2 == n){\n\t\t\tmin = Math.min(min,n-y1+x2);\n\t\t}else if(x2 == 0 && y1 == n){\n\t\t\tmin = Math.min(min,n-y2+x1);\n\t\t}else if(x1 == n && y2 == n){\n\t\t\tmin = Math.min(min, n-y1+n-x2);\n\t\t}else if(x2 == n && y1 == n){\n\t\t\tmin = Math.min(min, n-x1+n-y2);\n\t\t}else if((x1 == 0 && x2 == 0) || (x1 == n && x2 == n)){\n\t\t\tmin = Math.min(min,Math.abs(y1-y2));\n\t\t}else if((y1 == 0 && y2 == 0) || (y1 == n && y2 == n)){\n\t\t\tmin = Math.min(min,Math.abs(x1-x2));\n\t\t}\n\t\tSystem.out.println(min);\n\t}\n\n\tprivate static class FastScanner {\n\t\tprivate final InputStream in = System.in;\n\t\tprivate final byte[] buffer = new byte[1024];\n\t\tprivate int ptr = 0;\n\t\tprivate int buflen = 0;\n\t\tprivate boolean hasNextByte() {\n\t\t\t\tif (ptr < buflen) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t}else{\n\t\t\t\t\t\tptr = 0;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tbuflen = in.read(buffer);\n\t\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (buflen <= 0) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t}\n\t\tprivate int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}\n\t\tprivate static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}\n\t\tpublic boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}\n\t\tpublic String next() {\n\t\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\t\tint b = readByte();\n\t\t\t\twhile(isPrintableChar(b)) {\n\t\t\t\t\t\tsb.appendCodePoint(b);\n\t\t\t\t\t\tb = readByte();\n\t\t\t\t}\n\t\t\t\treturn sb.toString();\n\t\t}\n\t\tpublic long nextLong() {\n\t\t\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\t\t\tlong n = 0;\n\t\t\t\tboolean minus = false;\n\t\t\t\tint b = readByte();\n\t\t\t\tif (b == '-') {\n\t\t\t\t\t\tminus = true;\n\t\t\t\t\t\tb = readByte();\n\t\t\t\t}\n\t\t\t\tif (b < '0' || '9' < b) {\n\t\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t}\n\t\t\t\twhile(true){\n\t\t\t\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\t\t\t\t\tn *= 10;\n\t\t\t\t\t\t\t\tn += b - '0';\n\t\t\t\t\t\t}else if(b == -1 || !isPrintableChar(b)){\n\t\t\t\t\t\t\t\treturn minus ? -n : n;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tthrow new NumberFormatException();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tb = readByte();\n\t\t\t\t}\n\t\t}\n\t\tpublic int nextInt() {\n\t\t\t\tlong nl = nextLong();\n\t\t\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\t\t\treturn (int) nl;\n\t\t}\n\t\tpublic double nextDouble() { return Double.parseDouble(next());}\n\t}\n}\n","testcases":"[{'input': '2 0 0 1 0\\r\\n', 'output': ['1']}, {'input': '2 0 1 2 1\\r\\n', 'output': ['4']}, {'input': '100 0 0 100 100\\r\\n', 'output': ['200']}, {'input': '4 0 3 1 4\\r\\n', 'output': ['2']}, {'input': '10 8 10 10 0\\r\\n', 'output': ['12']}, {'input': '26 21 0 26 14\\r\\n', 'output': ['19']}, {'input': '15 0 1 11 0\\r\\n', 'output': ['12']}, {'input': '26 26 7 26 12\\r\\n', 'output': ['5']}, {'input': '6 6 0 2 6\\r\\n', 'output': ['10']}, {'input': '5 1 5 2 5\\r\\n', 'output': ['1']}, {'input': '99 12 0 35 99\\r\\n', 'output': ['146']}, {'input': '44 44 31 28 0\\r\\n', 'output': ['47']}, {'input': '42 42 36 5 0\\r\\n', 'output': ['73']}, {'input': '87 87 66 0 5\\r\\n', 'output': ['158']}, {'input': '85 0 32 0 31\\r\\n', 'output': ['1']}, {'input': '30 20 30 3 0\\r\\n', 'output': ['53']}, {'input': '5 4 0 5 1\\r\\n', 'output': ['2']}, {'input': '40 24 40 4 0\\r\\n', 'output': ['68']}, {'input': '11 0 2 11 4\\r\\n', 'output': ['17']}, {'input': '82 0 11 35 0\\r\\n', 'output': ['46']}, {'input': '32 19 32 0 1\\r\\n', 'output': ['50']}, {'input': '54 12 0 0 44\\r\\n', 'output': ['56']}, {'input': '75 42 75 28 0\\r\\n', 'output': ['145']}, {'input': '48 31 48 0 4\\r\\n', 'output': ['75']}, {'input': '69 4 69 69 59\\r\\n', 'output': ['75']}, {'input': '561 0 295 233 0\\r\\n', 'output': ['528']}, {'input': '341 158 0 0 190\\r\\n', 'output': ['348']}, {'input': '887 887 461 39 887\\r\\n', 'output': ['1274']}, {'input': '700 0 288 700 368\\r\\n', 'output': ['1356']}, {'input': '512 70 512 512 99\\r\\n', 'output': ['855']}, {'input': '826 188 826 592 0\\r\\n', 'output': ['1606']}, {'input': '953 0 773 0 903\\r\\n', 'output': ['130']}, {'input': '80 80 4 0 54\\r\\n', 'output': ['138']}, {'input': '208 73 0 208 123\\r\\n', 'output': ['258']}, {'input': '983 0 894 199 0\\r\\n', 'output': ['1093']}, {'input': '686 615 686 470 686\\r\\n', 'output': ['145']}, {'input': '869 869 833 0 578\\r\\n', 'output': ['1196']}, {'input': '169 0 94 0 132\\r\\n', 'output': ['38']}, {'input': '68 42 68 68 28\\r\\n', 'output': ['66']}, {'input': '967 967 607 279 0\\r\\n', 'output': ['1295']}, {'input': '489 489 139 455 489\\r\\n', 'output': ['384']}, {'input': '964 205 964 604 964\\r\\n', 'output': ['399']}, {'input': '86 0 34 86 21\\r\\n', 'output': ['141']}, {'input': '209 166 209 131 0\\r\\n', 'output': ['330']}, {'input': '684 684 113 314 684\\r\\n', 'output': ['941']}, {'input': '16 0 6 0 8\\r\\n', 'output': ['2']}, {'input': '862 154 862 297 862\\r\\n', 'output': ['143']}, {'input': '418 222 0 254 418\\r\\n', 'output': ['778']}, {'input': '571 504 571 143 571\\r\\n', 'output': ['361']}, {'input': '371 371 210 81 371\\r\\n', 'output': ['451']}, {'input': '1000 0 0 1000 1000\\r\\n', 'output': ['2000']}, {'input': '1000 564 0 436 1000\\r\\n', 'output': ['2000']}, {'input': '1000 0 573 12 1000\\r\\n', 'output': ['439']}, {'input': '1000 984 0 1000 999\\r\\n', 'output': ['1015']}, {'input': '100 10 0 10 0\\r\\n', 'output': ['0']}]","id":85} {"description":"Once Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price \u2014 their owners are ready to pay Bob if he buys their useless apparatus. Bob can \u00abbuy\u00bb any TV sets he wants. Though he's very strong, Bob can carry at most m TV sets, and he has no desire to go to the sale for the second time. Please, help Bob find out the maximum sum of money that he can earn.","input_specification":"The first line contains two space-separated integers n and m (1\u2009\u2264\u2009m\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of TV sets at the sale, and amount of TV sets that Bob can carry. The following line contains n space-separated integers ai (\u2009-\u20091000\u2009\u2264\u2009ai\u2009\u2264\u20091000) \u2014 prices of the TV sets. ","output_specification":"Output the only number \u2014 the maximum sum of money that Bob can earn, given that he can carry at most m TV sets.","notes":null,"sample_inputs":["5 3\n-6 0 35 -2 4","4 2\n7 0 0 -7"],"sample_outputs":["8","7"],"src_uid":"9a56288d8bd4e4e7ef3329e102f745a5","lang_cluster":"Java","difficulty":900,"human_solution":"import java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Scanner;\n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int m =sc.nextInt() ,n =sc.nextInt();\n int a [] = new int[m];\n\n for(int i=0;i max){max = scores[i]; pos = i;}\n }\n System.out.println(handles[pos]);\n }\n}","testcases":"[{'input': '5\\r\\nPetr 3 1 490 920 1000 1200 0\\r\\ntourist 2 0 490 950 1100 1400 0\\r\\nEgor 7 0 480 900 950 0 1000\\r\\nc00lH4x0R 0 10 150 0 0 0 0\\r\\nsome_participant 2 1 450 720 900 0 0\\r\\n', 'output': ['tourist']}, {'input': '1\\r\\nA 0 0 200 0 0 0 0\\r\\n', 'output': ['A']}, {'input': '2\\r\\n12345678901234567890 1 0 200 0 0 0 0\\r\\n_ 1 0 201 0 0 0 0\\r\\n', 'output': ['_']}, {'input': '5\\r\\nAb 0 0 481 900 1200 1600 2000\\r\\nCd 0 0 480 899 1200 1600 2000\\r\\nEf 0 0 480 900 1200 1600 2000\\r\\ngH 0 0 480 900 1200 1599 2000\\r\\nij 0 0 480 900 1199 1600 2001\\r\\n', 'output': ['Ab']}, {'input': '4\\r\\nF1 0 0 150 0 0 0 0\\r\\nF2 0 1 0 0 0 0 0\\r\\nF3 0 2 0 0 0 0 0\\r\\nF4 0 3 0 0 0 0 0\\r\\n', 'output': ['F1']}, {'input': '2\\r\\nA87h 5 0 199 0 0 0 0\\r\\nBcfg 7 0 0 0 0 0 0\\r\\n', 'output': ['Bcfg']}, {'input': '10\\r\\nKh 40 26 0 0 0 0 1243\\r\\nn 46 50 500 0 910 1912 0\\r\\nU 18 1 182 0 457 0 0\\r\\nFth6A0uT6i 38 30 0 787 0 1121 0\\r\\nC5l 24 38 0 689 1082 0 0\\r\\nN 47 25 0 0 1065 0 1538\\r\\nznyL 9 24 0 315 0 0 0\\r\\nJ0kU 27 47 445 0 0 0 0\\r\\nlT0rwiD2pg 46 13 0 818 0 0 0\\r\\nuJzr 29 14 0 0 0 0 2387\\r\\n', 'output': ['N']}, {'input': '2\\r\\nminus_one 0 4 199 0 0 0 0\\r\\nminus_two 0 4 198 0 0 0 0\\r\\n', 'output': ['minus_one']}, {'input': '10\\r\\nW22kb1L1 0 39 0 465 0 1961 865\\r\\n1MCXiVYmu5ys0afl 0 38 0 0 0 1982 1241\\r\\nCxg706kUJtQ 0 23 211 0 0 1785 1056\\r\\nmzEY 0 16 0 0 0 1988 1404\\r\\nv8JUjmam5SFP 0 48 0 788 1199 1426 0\\r\\n7giq 0 21 0 780 1437 1363 1930\\r\\nsXsUGbAulj6Lbiq 0 32 205 0 0 603 0\\r\\nRepIrY1Er4PgK 0 13 381 872 927 1488 0\\r\\nleKBdKHLnLFz 0 29 220 0 0 1006 889\\r\\nD 0 26 497 0 0 0 1815\\r\\n', 'output': ['7giq']}, {'input': '1\\r\\nZ 0 0 0 0 0 0 0\\r\\n', 'output': ['Z']}, {'input': '3\\r\\nAbcd 0 4 189 0 0 0 0\\r\\nDefg 0 5 248 0 0 0 0\\r\\nGhh 1 3 0 0 0 0 0\\r\\n', 'output': ['Defg']}, {'input': '3\\r\\ndf 0 6 0 0 0 0 0\\r\\njnm 1 8 300 0 0 0 0\\r\\n_ub_ 3 20 300 310 0 0 0\\r\\n', 'output': ['jnm']}, {'input': '1\\r\\njhgcyt 0 50 0 0 0 0 0\\r\\n', 'output': ['jhgcyt']}, {'input': '2\\r\\njhv 0 50 500 1000 1500 2000 2500\\r\\nPetr 2 1 489 910 1100 1300 1000\\r\\n', 'output': ['jhv']}, {'input': '3\\r\\nufu 0 50 0 0 0 0 0\\r\\nhzEr65f 1 50 0 0 0 0 0\\r\\nytdttjfhfd 0 50 150 0 0 0 0\\r\\n', 'output': ['ytdttjfhfd']}, {'input': '5\\r\\nufuf 0 50 0 0 0 0 0\\r\\nyfycy 50 0 500 1000 1500 2000 2500\\r\\n__u77 6 7 490 999 1456 1976 1356\\r\\n0 1 2 0 0 0 0 2452\\r\\ngu7fF 50 0 500 1000 1500 2000 2499\\r\\n', 'output': ['yfycy']}, {'input': '2\\r\\nhfy 0 50 0 0 0 0 2500\\r\\nugug 0 50 0 0 0 0 2499\\r\\n', 'output': ['hfy']}, {'input': '8\\r\\nA 0 0 0 0 0 0 0\\r\\nb 0 0 0 0 0 0 0\\r\\nc 0 0 0 0 0 0 0\\r\\nD 0 0 0 0 0 0 0\\r\\nE 1 0 0 0 0 0 0\\r\\nF 0 0 0 0 0 0 0\\r\\ng 0 0 0 0 0 0 0\\r\\nH 0 0 0 0 0 0 0\\r\\n', 'output': ['E']}, {'input': '2\\r\\nyyyc 50 50 0 0 0 0 0\\r\\nydd 0 0 0 0 0 0 2499\\r\\n', 'output': ['yyyc']}, {'input': '2\\r\\ntom 0 2 0 0 0 0 0\\r\\nmac 0 1 0 0 0 0 0\\r\\n', 'output': ['mac']}, {'input': '1\\r\\ncool 0 10 0 0 0 0 0\\r\\n', 'output': ['cool']}]","id":90} {"description":"\u00c6sir - CHAOS \u00c6sir - V.\"Everything has been planned out. No more hidden concerns. The condition of Cytus is also perfect.The time right now...... 00:01:12......It's time.\"The emotion samples are now sufficient. After almost 3 years, it's time for Ivy to awake her bonded sister, Vanessa.The system inside A.R.C.'s Library core can be considered as an undirected graph with infinite number of processing nodes, numbered with all positive integers ($$$1, 2, 3, \\ldots$$$). The node with a number $$$x$$$ ($$$x > 1$$$), is directly connected with a node with number $$$\\frac{x}{f(x)}$$$, with $$$f(x)$$$ being the lowest prime divisor of $$$x$$$.Vanessa's mind is divided into $$$n$$$ fragments. Due to more than 500 years of coma, the fragments have been scattered: the $$$i$$$-th fragment is now located at the node with a number $$$k_i!$$$ (a factorial of $$$k_i$$$).To maximize the chance of successful awakening, Ivy decides to place the samples in a node $$$P$$$, so that the total length of paths from each fragment to $$$P$$$ is smallest possible. If there are multiple fragments located at the same node, the path from that node to $$$P$$$ needs to be counted multiple times.In the world of zeros and ones, such a requirement is very simple for Ivy. Not longer than a second later, she has already figured out such a node.But for a mere human like you, is this still possible?For simplicity, please answer the minimal sum of paths' lengths from every fragment to the emotion samples' assembly node $$$P$$$.","input_specification":"The first line contains an integer $$$n$$$ ($$$1 \\le n \\le 10^6$$$)\u00a0\u2014 number of fragments of Vanessa's mind. The second line contains $$$n$$$ integers: $$$k_1, k_2, \\ldots, k_n$$$ ($$$0 \\le k_i \\le 5000$$$), denoting the nodes where fragments of Vanessa's mind are located: the $$$i$$$-th fragment is at the node with a number $$$k_i!$$$.","output_specification":"Print a single integer, denoting the minimal sum of path from every fragment to the node with the emotion samples (a.k.a. node $$$P$$$). As a reminder, if there are multiple fragments at the same node, the distance from that node to $$$P$$$ needs to be counted multiple times as well.","notes":"NoteConsidering the first $$$24$$$ nodes of the system, the node network will look as follows (the nodes $$$1!$$$, $$$2!$$$, $$$3!$$$, $$$4!$$$ are drawn bold):For the first example, Ivy will place the emotion samples at the node $$$1$$$. From here: The distance from Vanessa's first fragment to the node $$$1$$$ is $$$1$$$. The distance from Vanessa's second fragment to the node $$$1$$$ is $$$0$$$. The distance from Vanessa's third fragment to the node $$$1$$$ is $$$4$$$. The total length is $$$5$$$.For the second example, the assembly node will be $$$6$$$. From here: The distance from Vanessa's first fragment to the node $$$6$$$ is $$$0$$$. The distance from Vanessa's second fragment to the node $$$6$$$ is $$$2$$$. The distance from Vanessa's third fragment to the node $$$6$$$ is $$$2$$$. The distance from Vanessa's fourth fragment to the node $$$6$$$ is again $$$2$$$. The total path length is $$$6$$$.","sample_inputs":["3\n2 1 4","4\n3 1 4 4","4\n3 1 4 1","5\n3 1 4 1 5"],"sample_outputs":["5","6","6","11"],"src_uid":"40002052843ca0357dbd3158b16d59f4","lang_cluster":"Java","difficulty":2700,"human_solution":"import java.io.*;\nimport java.util.*;\n\npublic class Akisolution {\n\tpublic static Scanner sc = new Scanner(System.in);\n\tpublic static PrintWriter out = new PrintWriter(System.out, true);\n\tpublic static final int MAXK = 5000;\n\tpublic static int n;\n\tpublic static int[] cnt = new int[MAXK + 1];\n\tpublic static int[][] primeExponential = new int[MAXK + 1][MAXK + 1];\n\n\tpublic static long min(long a, long b) {return ((a < b) ? a : b);}\n\n\tpublic static int max_element(int[] arr) {\n\t\tint res = -1000000000;\n\t\tfor (int i=0; i res) res = arr[i];\n\t\t}\n\t\treturn res;\n\t}\n\n\tpublic static int max_id(int[] arr) {\n\t\tint res = -1000000000, id = -1;\n\t\tfor (int i=0; i res) {\n\t\t\t\tres = arr[i];\n\t\t\t\tid = i;\n\t\t\t}\n\t\t}\n\t\treturn id;\n\t}\n\n\tpublic static void Preprocess() {\n\t\tfor (int i=2; i 1) primeExponential[i][tmp]++;\n\t\t}\n\t}\n\n\tpublic static void Input() {\n\t\tn = sc.nextInt();\n\t\tfor (int i=0; i 1) {\n\t\t\tint[] frequency = new int[MAXK + 1];\n\n\t\t\tfor (int i=0; i 1 && primeExponential[i][bestPD[i]] == 0) bestPD[i]--;\n\t\t\t}\n\t\t}\n\n\t\tout.println(ans);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tInput(); Solve();\n\t}\n}","testcases":"[{'input': '3\\r\\n2 1 4\\r\\n', 'output': ['5']}, {'input': '4\\r\\n3 1 4 4\\r\\n', 'output': ['6']}, {'input': '4\\r\\n3 1 4 1\\r\\n', 'output': ['6']}, {'input': '5\\r\\n3 1 4 1 5\\r\\n', 'output': ['11']}, {'input': '11\\r\\n5000 5000 5000 5000 5000 5000 0 1 0 1 0\\r\\n', 'output': ['77835']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '4\\r\\n0 1 1 0\\r\\n', 'output': ['0']}, {'input': '17\\r\\n1 9 2 8 4 5 7 3 8 4 6 2 8 4 1 0 5\\r\\n', 'output': ['87']}, {'input': '4\\r\\n57 918 827 953\\r\\n', 'output': ['7835']}, {'input': '51\\r\\n17 26 14 0 41 18 40 14 29 25 5 23 46 20 8 14 12 27 8 38 9 42 17 16 31 2 5 45 16 35 37 1 46 27 27 16 20 38 11 48 11 3 23 40 10 46 31 47 32 49 17\\r\\n', 'output': ['2366']}, {'input': '95\\r\\n28 12 46 4 24 37 23 19 7 22 29 34 10 10 9 11 9 17 26 23 8 42 12 31 33 39 25 17 1 41 30 21 11 26 14 43 19 24 32 14 3 42 29 47 40 16 27 43 33 28 6 25 40 4 0 21 5 36 2 3 35 38 49 41 32 34 0 27 30 44 45 18 2 6 1 50 13 22 20 20 7 5 16 18 13 15 15 36 39 37 31 35 48 38 8\\r\\n', 'output': ['4286']}, {'input': '49\\r\\n27 12 48 48 9 10 29 50 48 48 48 48 11 14 18 27 48 48 48 48 1 48 33 48 27 48 48 48 12 16 48 48 22 48 48 36 31 32 31 48 50 43 20 48 48 48 48 48 16\\r\\n', 'output': ['3484']}, {'input': '17\\r\\n12 12 5 1 3 12 4 2 12 12 12 12 6 12 7 12 0\\r\\n', 'output': ['179']}, {'input': '70\\r\\n50 0 50 0 0 0 0 0 0 50 50 50 50 0 50 50 0 50 50 0 0 0 50 50 0 0 50 0 50 0 50 0 0 50 0 0 0 0 50 50 50 50 0 0 0 0 0 0 0 0 50 0 50 50 0 50 0 0 0 0 50 0 50 0 0 50 0 50 0 0\\r\\n', 'output': ['3024']}, {'input': '295060\\r\\n38 23 17 20 28 38 38 28 32 7 20 0 14 31 41 16 46 39 41 8 40 14 33 36 11 2 40 8 19 36 13 29 4 22 4 12 17 38 50 35 10 40 21 7 21 2 27 34 30 40 22 37 20 5 12 42 33 16 22 45 14 26 16 27 7 24 48 1 15 40 0 27 47 25 29 42 23 23 16 17 20 1 6 38 12 0 19 34 20 43 44 8 47 23 17 5 38 40 43 46 12 29 41 10 2 4 23 22 24 45 42 39 11 19 0 4 7 1 0 13 42 3 42 49 43 39 22 36 47 17 0 35 39 15 42 16 6 20 17 43 17 4 4 30 14 45 3 7 47 12 10 41 16 45 11 5 13 37 49 36 44 24 38 3 48 26 5 10 26 32 4 35 13 40 9 42 42 40 36 22 ...', 'output': ['14408680']}, {'input': '68484\\r\\n45 1 16 1 50 16 29 39 50 46 28 5 11 28 19 5 41 23 15 30 20 7 18 6 30 27 35 31 33 13 3 1 12 11 46 28 42 17 13 5 43 36 21 45 1 38 39 36 29 10 42 6 26 37 26 3 36 0 45 27 2 9 42 33 45 39 21 19 48 14 10 14 20 12 47 38 29 32 37 17 50 10 29 6 5 48 37 48 24 26 36 7 4 26 12 42 40 35 32 22 17 35 9 47 11 13 10 10 4 13 32 23 30 26 22 20 20 0 49 38 33 16 46 50 21 40 2 15 13 26 16 3 22 47 37 35 23 34 22 40 22 12 42 13 39 25 46 25 47 12 1 43 25 1 32 25 26 18 8 50 27 45 45 9 42 25 12 27 48 6 15 2 14 41 3 7 6 0 29 2...', 'output': ['3345881']}, {'input': '1000000\\r\\n3722 452 4276 30 137 3139 4268 4696 1846 2667 4961 3074 4236 4685 4087 2731 3444 4322 4932 2801 3270 3 1629 4477 3073 4958 3274 760 978 4270 3836 1343 4543 1770 2995 2073 3085 1190 4630 635 3582 1483 1953 990 4430 1546 1787 916 3572 2781 189 1832 2275 3122 714 931 4259 2670 241 3550 387 1032 3317 3802 1423 160 1717 1783 3911 4966 1947 4002 1905 2708 3798 4609 2264 399 4637 705 19 1194 1688 1682 1543 3335 521 4343 3036 3527 398 3205 444 1392 1226 3770 3775 4669 3394 3907 3857 4711 3696 2203 395 222...', 'output': ['7607420444']}, {'input': '1000000\\r\\n522 4027 3242 3953 143 2524 1807 4590 574 4082 4545 59 1875 3013 2181 906 2440 892 727 1900 57 480 1275 1115 4406 2958 4632 3920 1901 1611 1826 3199 2393 1268 1140 1549 3367 3625 4123 4996 4480 3553 1483 1236 3965 4973 4534 4546 2637 1999 1073 929 4043 1343 1310 850 188 1005 4228 2198 388 1001 2549 4137 212 3001 3231 1987 3806 2926 4746 355 1552 431 635 3372 1820 396 1425 3998 1362 3213 2589 4102 2081 761 438 409 902 4512 1274 520 1789 3499 414 2074 542 1784 1706 2436 199 1508 4900 1968 527 1815 3...', 'output': ['7605550222']}, {'input': '1000000\\r\\n2976 2807 1350 3599 2725 1350 2266 3745 1350 1350 1607 4715 1803 1350 1350 2355 1350 1350 1350 1350 1350 1350 3814 1008 2634 4272 153 1350 2335 1350 1350 2952 2395 1187 2912 1392 1350 208 1350 1350 2711 1350 4116 195 130 3661 2624 1350 1350 3561 1350 1350 1350 1350 1350 1350 1350 3830 4407 1056 1350 1350 3003 1212 1350 2702 1469 1483 1025 3345 1350 4493 1350 1350 1350 3324 1350 1350 1693 2153 1350 4035 1772 1350 1350 1350 1350 1469 2034 3780 1920 1050 1350 1350 1350 1921 4707 3667 1350 1350 1887 1...', 'output': ['5780430738']}, {'input': '1000000\\r\\n935 1374 1374 1834 1431 4393 1520 1678 1374 917 4059 1374 1374 1374 4957 1374 808 1374 1374 1374 1374 122 1374 1374 1374 3800 396 1374 1374 1374 1374 878 1374 648 1374 1374 1374 1374 2763 845 1374 1374 1374 1122 1374 1374 1374 1374 1374 1374 1374 1374 4696 1915 3392 1374 3781 1374 3861 4681 1864 1374 1374 2556 1978 1374 4166 1374 4140 1374 1374 4675 1436 1374 3101 1374 1374 83 1374 1374 4251 143 1374 4060 2303 1374 341 1374 1374 1374 1374 1374 269 1374 4575 1925 1374 1374 1374 3286 1374 3996 1374 ...', 'output': ['5811523118']}, {'input': '1000000\\r\\n0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 5000 5000 0 0 5000 0 5000 0 0 5000 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 5000 0 0...', 'output': ['1950296028']}, {'input': '1000000\\r\\n5000 0 5000 0 0 0 0 0 5000 0 0 5000 0 5000 0 0 0 5000 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 0 0 5000 0 0 5000 0 0 0 0 5000 5000 5000 0 0 5000 0 0 0 5000 5000 0 0 0 5000 5000 0 0 0 0 0 5000 0 5000 0 0 0 0 0 5000 5000 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 5000 0 0 0 0 5000 0 0 0 0 0 5000 5000 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 5000 5000 0 0 0 0 0 5000 5000 5000 5000 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 5000 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 5000 0 0 0 0 5000 5000 0 5000 ...', 'output': ['3888512064']}, {'input': '1000000\\r\\n0 0 5000 5000 5000 5000 5000 0 0 5000 5000 0 5000 0 0 0 0 0 0 5000 0 5000 5000 5000 5000 0 0 0 0 0 5000 5000 5000 5000 0 0 5000 5000 5000 5000 0 5000 5000 5000 0 5000 0 0 0 0 0 0 0 5000 5000 0 0 0 5000 0 5000 0 0 5000 0 5000 0 5000 5000 5000 0 5000 5000 0 5000 5000 0 5000 5000 0 0 0 5000 0 5000 5000 0 0 0 0 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000 0 5000 0 0 0 5000 0 5000 0 0 5000 0 0 0 5000 0 0 0 5000 0 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 0 0 5000 0 50...', 'output': ['7779561549']}, {'input': '1000000\\r\\n5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 0 5000 0 5000 5000 0 5000 5000 5000 5000 5000 0 0 5000 0 5000 5000 0 0 5000 5000 0 0 0 5000 5000 0 0 5000 5000 0 5000 5000 0 5000 5000 0 5000 5000 0 5000 0 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 0 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 0 0 5000 ...', 'output': ['3888449796']}, {'input': '1000000\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 0 0 5000 5000 0 0 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 500...', 'output': ['1947260463']}, {'input': '1000000\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 50...', 'output': ['0']}, {'input': '13\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 50\\r\\n', 'output': ['108']}, {'input': '45\\r\\n50 0 0 0 0 0 0 0 0 50 0 0 50 0 0 50 50 0 0 0 0 0 50 0 0 0 0 0 50 50 0 0 0 0 50 0 50 0 50 0 0 0 0 0 50\\r\\n', 'output': ['1296']}, {'input': '24\\r\\n50 0 50 50 50 0 50 50 0 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50\\r\\n', 'output': ['540']}, {'input': '68\\r\\n50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 0 0 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50\\r\\n', 'output': ['864']}, {'input': '75\\r\\n2597 1818 260 4655 4175 2874 2987 4569 2029 4314 444 2276 4937 1209 1797 4965 3526 275 3535 2198 4402 2144 1369 13 4453 1655 4456 711 3563 1650 3997 885 782 147 2426 974 2917 2100 4549 2465 3015 3485 3238 4086 171 3934 1903 133 2278 2573 688 551 872 459 2044 1401 2429 4933 3747 587 2781 4173 4651 4012 1407 2352 1461 566 2062 4599 1430 2269 3914 1820 4728\\r\\n', 'output': ['565559']}, {'input': '29\\r\\n8 27 14 21 6 20 2 11 3 19 10 16 0 25 18 4 23 17 15 26 28 1 13 5 9 22 12 7 24\\r\\n', 'output': ['692']}, {'input': '87\\r\\n1120 1120 1120 872 1120 731 3583 2815 4019 1291 4568 973 1120 1705 1120 822 203 1120 1120 1120 1120 4196 3166 4589 3030 1120 1120 1120 711 1120 500 1120 1120 3551 1120 1120 1120 1700 1120 1120 2319 4554 1120 1312 1120 1120 4176 1120 1120 3661 1120 1120 1120 1120 142 63 4125 1120 4698 3469 1829 567 1120 1120 1083 486 1120 1120 1120 1120 3763 1120 247 4496 454 1120 1120 1532 1120 4142 352 1120 359 2880 1120 1120 4494\\r\\n', 'output': ['438276']}, {'input': '27\\r\\n9 1144 1144 2 8 1144 12 0 1144 1144 7 3 1144 1144 11 10 1 1144 1144 5 1144 4 1144 1144 1144 1144 6\\r\\n', 'output': ['43222']}, {'input': '27\\r\\n0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 5000\\r\\n', 'output': ['62268']}, {'input': '59\\r\\n0 0 0 5000 0 0 0 5000 5000 0 5000 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 5000 0 5000 0 5000 0 0 5000 0 5000 0 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 5000 0 0 0 5000\\r\\n', 'output': ['233505']}, {'input': '80\\r\\n0 0 0 0 5000 0 0 5000 5000 5000 0 5000 0 5000 5000 0 0 0 0 5000 5000 0 0 5000 0 5000 5000 5000 0 5000 0 5000 5000 5000 0 0 5000 0 0 5000 5000 0 0 5000 0 5000 5000 5000 0 0 5000 5000 5000 0 0 5000 0 0 5000 0 5000 5000 0 5000 0 5000 0 5000 0 5000 0 0 0 0 5000 5000 5000 0 0 0\\r\\n', 'output': ['591546']}, {'input': '20\\r\\n0 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000\\r\\n', 'output': ['77835']}, {'input': '78\\r\\n0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 0 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000\\r\\n', 'output': ['249072']}, {'input': '3241\\r\\n20 31 49 20 24 6 33 50 24 30 6 50 45 34 43 40 35 10 27 4 43 19 42 16 20 49 20 32 18 41 36 32 26 37 9 21 29 16 22 27 9 48 47 29 30 15 43 24 26 20 3 11 4 35 12 42 48 11 44 46 31 44 20 47 0 7 7 18 47 3 18 8 4 9 2 48 28 22 32 4 24 37 32 26 49 12 4 10 44 50 41 23 5 26 1 5 34 4 1 13 39 26 24 25 25 9 37 5 22 15 12 49 48 2 28 37 42 44 45 30 4 41 43 7 44 39 9 21 47 41 7 17 18 14 19 13 35 8 36 39 1 18 47 25 48 22 44 41 12 17 5 5 44 48 9 4 49 37 34 9 13 37 21 40 45 13 3 32 22 12 25 48 24 6 28 9 41 2 45 28 31 9 ...', 'output': ['160831']}, {'input': '3569\\r\\n11 34 14 46 1 12 5 13 5 46 35 8 36 28 7 16 16 47 29 45 27 36 47 22 2 33 5 38 23 34 24 48 15 27 20 14 31 8 18 15 44 10 47 28 17 36 34 48 10 48 29 35 31 15 19 17 26 42 15 45 21 16 9 31 30 32 50 12 48 37 46 2 10 32 36 8 38 25 20 3 26 7 35 33 38 6 16 30 42 38 47 16 20 23 36 30 20 24 38 5 1 16 40 31 14 6 10 27 2 4 32 1 12 6 43 43 34 32 19 9 47 34 22 37 9 50 33 18 45 42 20 19 49 20 49 25 3 41 36 46 41 21 21 26 43 50 37 23 11 34 32 3 32 42 35 6 18 45 47 16 19 33 2 34 35 44 11 47 13 24 10 31 13 37 48 42 22 3...', 'output': ['174332']}, {'input': '5489\\r\\n2 18 8 33 36 26 20 18 26 0 26 42 26 5 10 26 26 26 26 2 26 0 28 26 26 26 26 26 28 30 25 24 26 2 26 26 39 26 26 26 26 31 26 26 26 46 26 5 26 26 45 16 26 7 26 26 26 26 49 26 26 1 0 8 26 19 3 18 8 38 26 14 40 31 44 26 26 26 26 26 30 42 26 10 26 18 29 32 8 29 3 26 26 26 6 26 26 6 26 26 26 34 26 26 4 10 0 47 49 26 26 26 1 18 29 12 23 2 39 50 4 17 26 29 8 26 13 35 26 16 42 30 26 26 46 6 42 26 26 26 5 24 26 26 46 29 26 35 26 26 26 23 26 26 26 26 26 26 26 26 26 26 26 26 50 33 26 31 26 26 47 26 26 26 26 6 26 2...', 'output': ['260842']}, {'input': '5817\\r\\n41 18 41 41 25 41 41 39 1 6 41 40 41 41 41 41 0 41 41 41 41 17 41 41 41 39 41 12 41 0 41 36 40 41 41 41 41 11 41 27 13 41 29 41 22 41 41 33 14 19 18 41 41 32 41 5 41 2 34 13 47 41 41 41 41 45 18 41 43 42 41 12 9 41 41 41 35 10 41 41 41 41 44 41 41 30 41 7 25 41 46 42 41 12 41 41 48 13 23 41 17 41 44 41 1 41 24 3 41 41 41 26 41 41 6 7 41 0 10 2 16 29 41 34 41 39 36 41 3 41 41 36 2 24 35 38 36 37 41 41 38 8 42 36 0 35 37 2 41 28 41 38 36 13 41 41 16 41 31 43 1 38 19 23 41 41 41 17 9 41 25 41 45 19 10 4...', 'output': ['377254']}, {'input': '2871\\r\\n0 0 0 0 0 50 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 50 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 0 0 0 50 0 0 0 50 0 0 0 50 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 50 0 0 50 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 ...', 'output': ['37260']}, {'input': '2543\\r\\n0 0 0 0 50 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 50 0 50 0 0 50 0 50 50 0 0 0 0 0 0 50 50 0 0 0 50 50 0 50 0 0 0 50 50 0 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 0 50 0 50 0 0 50 0 50 0 0 0 50 0 0 50 50 0 0 0 0 50 0 0 50 0 0 0 0 0 50 0 50 0 0 0 0 0 0 0 0 0 0 50 50 50 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 50 50 0 0 50 0 0 50 0 0 0 0 0 0 0 0 0 50 50 0 0 0 0 50 0 0 50 0 0 50 50 0 0 0 50 50 0 0 50 0 0 0 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 0 0 0 0 0...', 'output': ['66744']}, {'input': '6658\\r\\n50 50 50 0 0 50 0 0 50 0 0 50 50 0 50 50 0 0 50 50 0 50 50 50 50 0 50 0 0 50 50 0 50 0 0 0 0 0 50 0 0 0 50 0 50 50 50 50 0 50 0 50 50 50 50 50 50 50 0 0 50 0 0 50 0 50 0 0 50 50 50 0 0 0 0 0 50 0 0 0 50 0 0 0 50 0 50 0 50 50 50 50 0 0 50 50 0 50 50 0 0 0 50 50 0 0 50 50 0 0 0 50 0 0 50 50 50 50 50 0 0 0 0 50 50 50 50 0 0 0 0 0 0 0 50 0 50 50 50 0 0 0 50 0 50 50 50 50 50 0 0 50 50 0 0 0 0 50 0 50 0 50 50 0 0 0 50 50 0 50 50 50 0 50 0 0 0 0 0 50 50 50 0 50 0 0 0 0 0 0 50 50 0 0 50 50 0 50 50 0 50 50 0 ...', 'output': ['357156']}, {'input': '7782\\r\\n50 50 0 0 0 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 0 50 50 50 0 50 50 0 0 50 50 0 0 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 0 50 50 50 0 0 50 50 0 50 0 50 0 0 50 50 0 50 0 50 50 50 0 50 50 50 50 50 50 0 50 50 50 0 50 0 50 50 0 0 50 50 0 0 50 50 50 50 50 0 50 50 50 0 0 50 50 50 0 50 0 50 0 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 0 50 50 50 0 50 50 50 50 0 50 0 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 0 0 50 0 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 ...', 'output': ['202284']}, {'input': '8110\\r\\n0 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 0 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 0 50 5...', 'output': ['109080']}, {'input': '4463\\r\\n2612 1495 2859 1941 1446 2716 4690 4357 2841 4862 2243 3269 4454 995 3373 2249 4637 3365 2276 1330 3211 572 826 4368 2894 905 137 718 2081 3137 3718 4107 3420 1398 193 1255 504 325 879 3991 3579 4223 315 1854 418 1143 1822 4198 2589 1918 4633 1210 86 52 336 3709 2138 838 3815 866 595 3296 4810 699 234 2559 4523 349 3190 1770 267 987 489 2936 4000 907 4032 1122 293 1486 3054 4489 412 4844 3924 1750 1249 300 1593 2535 1028 1469 4747 4522 3000 1326 4214 2544 789 3632 2556 4190 2426 1185 2402 1880 3382 7...', 'output': ['33446396']}, {'input': '5587\\r\\n2623 467 1074 276 33 2358 829 2301 820 160 398 3363 4748 2942 4704 2516 1274 4663 634 4071 4825 143 2912 2888 2968 3925 3589 3793 3172 3541 3494 75 4914 342 2901 1959 45 4692 3580 1458 4080 3297 1947 2236 127 3280 3318 4024 1199 2520 4506 3727 4205 2762 4291 235 3535 2536 2526 2609 4920 2257 3986 2082 1471 2106 311 4015 3822 455 3335 2263 616 1187 464 390 1366 3124 4893 1719 4779 1197 2097 3292 1653 33 504 1596 1158 3852 3262 4875 428 854 1140 2848 3166 2498 1219 3806 556 4607 3368 421 1312 4387 4448...', 'output': ['38501618']}, {'input': '5915\\r\\n3291 884 4366 156 3584 3291 2124 2353 3291 3291 123 3989 805 3291 3291 3160 1562 3291 793 2707 3291 3291 3291 1504 3291 3291 891 3291 3291 3291 582 3291 3291 3291 3291 2333 715 4753 3291 3291 4111 4457 4577 3793 3291 3291 3291 1652 1916 3291 3882 251 912 4595 577 1650 3291 3291 3291 143 3506 1658 1944 3291 3291 3673 3291 3291 3291 646 3575 4523 3291 434 3291 1526 3291 3291 3853 4708 2083 3291 3291 2560 2032 825 3291 1770 3291 3291 2960 3291 1517 795 3291 3235 3601 2124 1798 3291 3291 1093 3291 3291 3...', 'output': ['51854645']}, {'input': '7039\\r\\n1790 834 1882 1790 1790 2803 2541 1790 3268 24 922 1790 1790 1790 2078 1790 939 1790 2717 1790 2404 1790 1790 1790 1480 1867 2257 3412 1790 1812 1790 1790 1790 3469 1790 2214 679 1919 3173 468 1790 1790 1790 2321 3045 1790 1790 1790 1329 1790 1790 1790 1790 1730 541 3140 1790 264 1604 2703 1790 1790 1790 2166 1790 1790 1790 1790 1790 949 1790 3427 1217 519 1790 1916 2692 1790 1199 2023 3315 1790 2503 1790 302 1790 1790 1790 1790 1790 2009 1790 1203 3040 1790 2836 1869 1790 1790 2613 1790 1790 2898 15...', 'output': ['37192065']}, {'input': '7716\\r\\n0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 5000 0 0 5000 0 0 0 0 0 0 5000 5000 5000 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 0 5000 0 0 0 0 5000 5000 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['15317928']}, {'input': '6592\\r\\n0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 5000 0 0 0 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 5000 0 0 0 0 0 5000 5000 0 0 0 0 5000 0 0 5000 5000 0 0 5000 0 5000 0 0 0 5000 0 5000 0 0 0 0 0 5000 0 5000 0 0 5000 5000 0 0 0 0 0 0 0 0 5000 5000 5000 0 0 0 0 0 5000 0 0 0 0 5000 0 0 5000 0 0 0 5000 0 0 5000 5000 0 5000 0 0 0 0 5000 0 0 5000 0 0 0 0 5000 0 0 0 0 0 5000 5000 0 0 5000 0 0 0 5000 0 5000 0 0 5000 0 0 0 0 0 0 5000 0 0 0 5000 0 5000 5000 0 5000 5000 0 0 0 0 5000...', 'output': ['26993178']}, {'input': '6927\\r\\n5000 0 0 5000 5000 0 0 0 5000 5000 5000 0 0 0 0 5000 0 5000 5000 0 0 5000 5000 5000 0 5000 0 5000 0 0 5000 0 0 0 0 0 0 0 5000 0 5000 0 0 0 5000 5000 0 0 0 0 5000 5000 0 5000 5000 0 0 5000 5000 5000 0 0 0 5000 0 5000 5000 5000 0 5000 5000 0 0 5000 5000 0 0 0 5000 0 0 0 5000 0 0 5000 5000 0 5000 5000 5000 0 0 0 5000 5000 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 0 5000 0 0 5000 5000 0 0 0 0 5000 0 5000 5000 0 5000 0 0 5000 0 5000 0 5000 0 0 5000 5000 0 5000 5000 0 5000 0 5000 5000 0 5000 5000 5000 5000 0 0 500...', 'output': ['53675016']}, {'input': '8051\\r\\n5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 0 5000 5000 5000 0 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 5000 5000 5000 5000 5000 0 0 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 0 0 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 5000 0 0 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 ...', 'output': ['31865649']}, {'input': '8379\\r\\n5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 0 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 500...', 'output': ['16516587']}, {'input': '831909\\r\\n17 49 28 4 26 17 17 17 34 17 3 18 17 0 28 17 17 45 17 17 17 7 13 17 17 17 17 17 17 17 17 17 19 0 17 43 17 17 17 17 43 17 17 17 17 6 36 17 27 19 47 17 44 0 17 17 20 24 17 17 17 32 15 17 17 25 30 17 17 17 18 3 47 17 17 45 17 17 20 40 3 17 29 17 17 17 17 40 17 17 17 17 31 17 4 47 24 17 19 17 39 17 37 17 47 13 17 3 17 17 20 17 17 48 17 49 34 18 17 13 20 30 19 17 17 17 17 17 12 47 22 42 29 17 20 17 17 17 32 7 7 17 17 17 17 17 46 32 20 17 5 17 17 50 17 17 38 21 17 36 37 18 17 38 17 11 9 8 17 17 48 29 25 ...', 'output': ['31683596']}, {'input': '258037\\r\\n33 8 33 0 33 33 33 48 33 16 40 33 38 23 33 33 33 33 33 4 46 33 17 17 33 6 33 27 33 19 5 33 10 33 27 33 48 12 33 33 33 20 23 33 33 28 11 33 33 33 28 33 50 33 33 33 33 5 33 33 33 33 35 47 33 33 33 3 13 11 33 17 33 33 33 38 33 33 44 3 33 33 33 31 33 33 33 33 33 33 18 8 29 10 33 33 33 33 15 1 37 7 7 33 17 5 33 31 38 33 27 44 17 38 33 33 49 33 33 2 33 33 30 33 31 13 39 46 33 18 28 41 42 33 14 33 33 33 10 8 33 33 33 33 33 33 33 46 33 33 33 25 34 22 33 39 33 30 24 33 33 1 33 44 15 15 33 41 20 33 45 33 27 ...', 'output': ['14441842']}, {'input': '328921\\r\\n50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 50 0 0 50 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 50 0 50 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...', 'output': ['4404996']}, {'input': '555497\\r\\n0 0 0 0 0 50 50 0 0 0 50 0 0 0 50 0 0 0 50 50 0 0 0 0 0 0 50 0 0 50 50 50 50 50 50 0 0 50 50 0 50 50 0 0 50 0 0 0 0 50 50 0 0 0 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 50 0 50 50 0 0 0 0 0 0 50 50 0 0 0 0 0 50 0 0 0 0 0 50 0 50 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 50 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 50 0 50 0 0 0 0 0 0 50 0 50 0 0 0 0 50 0 0 0 50 0 50 0 50 0 0 50 0 50 0 0 0 0 50 0 0 50 50 0 0 0 0 0 50 0 0 0 ...', 'output': ['14931972']}, {'input': '207904\\r\\n50 50 50 0 0 50 0 50 50 50 0 50 50 50 0 50 50 50 50 0 50 0 0 0 50 0 0 0 50 0 0 50 0 50 0 0 0 50 50 0 50 50 50 0 50 0 0 0 0 50 0 50 50 0 50 0 0 0 50 50 50 50 50 50 50 50 50 0 0 50 50 0 50 50 50 50 0 0 0 0 0 50 50 50 0 0 50 0 50 0 50 0 0 0 50 0 50 0 0 50 0 50 50 50 50 50 0 0 50 0 50 0 0 50 50 0 50 0 50 0 0 0 50 0 0 50 0 0 0 0 0 50 0 50 0 50 0 50 0 0 50 50 50 50 50 0 0 0 50 0 50 50 50 50 50 0 50 50 0 0 50 0 50 0 0 0 50 0 50 50 50 0 0 50 0 50 50 50 0 0 0 0 50 50 0 0 50 50 50 50 50 50 50 0 0 0 50 50 50 ...', 'output': ['11221740']}, {'input': '971328\\r\\n50 0 0 0 50 50 0 50 50 50 50 50 50 50 0 50 50 50 50 0 50 50 50 0 50 50 50 50 0 50 50 50 50 0 50 50 50 50 50 50 50 50 0 0 50 50 0 50 50 50 0 0 0 50 50 50 50 50 0 0 50 50 0 0 50 50 0 50 50 50 0 0 50 50 50 0 50 0 50 0 50 50 0 50 0 50 0 50 50 0 50 50 50 50 0 50 50 50 50 50 50 50 50 0 50 50 50 0 0 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 50 50 50 0 50 0 50 0 0 50 0 50 50 0 0 50 50 50 50 50 50 50 0 50 0 50 50 0 0 0 0 50 50 0 50 50 0 50 50 50 50 50 50 50 50 ...', 'output': ['26290440']}, {'input': '744752\\r\\n50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 5...', 'output': ['10077264']}, {'input': '973217\\r\\n2233 4962 2835 1271 712 2124 3765 510 914 3364 2648 3399 744 3777 1516 739 3844 3879 261 863 2101 791 2276 1691 2145 1603 819 2340 415 3123 3260 1225 4746 4672 937 742 3927 25 2177 640 72 245 4053 3213 1322 3725 2842 883 216 4345 815 1534 633 4222 1677 2151 949 2691 2931 1897 1678 2599 4295 953 656 2864 2956 4134 4556 2839 3201 878 4447 270 1517 647 4010 3382 683 660 1393 785 3285 1115 1057 3672 3462 1434 882 122 505 3504 1946 1152 2997 3360 605 966 4034 4790 1344 1579 4482 2472 4484 3325 2852 543 ...', 'output': ['7404434821']}, {'input': '103937\\r\\n1662 2609 1161 2445 296 1285 3447 58 3521 1582 3524 1259 2360 3741 3130 4570 2215 3091 2032 3518 2969 3181 1414 1632 2101 4556 3642 1734 1388 4300 1631 182 1633 3970 1837 3967 1914 3162 915 2404 1208 4583 4334 279 747 2251 4671 4416 4752 3641 3811 1089 3213 740 1502 3880 2044 2766 777 3050 2475 4741 1121 2863 1065 4146 4872 2094 139 755 2780 4115 3442 2104 4030 1891 3037 2769 739 2274 3313 3098 2415 3909 4771 2761 1623 4084 3038 3130 4758 2667 3792 247 8 2846 3218 3485 3149 3845 470 4108 1031 484 3...', 'output': ['783928844']}, {'input': '520065\\r\\n756 4889 1279 756 756 756 756 4981 756 756 3514 3153 756 1559 563 3198 756 1696 756 1161 756 756 4853 1600 2623 3399 756 756 2736 756 756 756 756 756 4089 756 756 1407 3919 1546 1651 756 2430 756 756 756 756 756 756 4836 4582 1305 1304 763 756 4644 4890 756 3162 2611 3242 4455 1792 1882 756 2208 2014 4995 756 2947 2876 4738 756 756 1113 756 891 756 756 756 265 3619 756 756 756 4725 756 756 756 774 4476 4539 214 756 756 125 2452 3861 2363 2240 3842 756 4106 756 1183 756 756 756 756 756 1798 1694 793...', 'output': ['2532637708']}, {'input': '293489\\r\\n1084 4053 780 780 950 694 780 3823 780 780 2601 780 780 1469 3089 780 780 780 780 4707 780 2191 3268 2411 2892 171 3953 4307 340 1869 780 780 4373 4183 3523 780 2859 1053 780 1433 780 780 780 780 780 320 780 780 780 780 1948 2097 780 4234 780 780 780 4624 3124 780 780 3087 780 335 4642 780 780 2633 780 1447 780 780 4153 4532 780 780 3217 780 2340 2143 4089 2517 2085 780 2774 4590 3449 780 780 780 780 3715 4933 1026 2606 780 780 780 927 1997 3757 3730 780 780 780 780 780 4839 1369 780 602 780 1430 2...', 'output': ['1431772162']}, {'input': '546122\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 5000 5000 5000 5000 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0...', 'output': ['1063817646']}, {'input': '772698\\r\\n0 5000 0 5000 0 0 0 0 0 5000 5000 0 0 0 0 5000 0 5000 0 0 0 5000 0 0 0 0 0 0 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 5000 5000 0 5000 0 5000 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 0 0 5000 0 5000 5000 0 0 0 5000 0 0 0 5000 0 5000 5000 0 0 0 5000 0 0 0 5000 0 0 5000 0 0 0 0 0 0 5000 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 5000 5000 0 0 0 0 5000 0 0 0 5000 0 0 0 0 0 5000 0 0 5000 5000 0 5000 0 0 0 0 5000 0...', 'output': ['3012463572']}, {'input': '331312\\r\\n0 5000 0 5000 5000 5000 0 5000 5000 0 5000 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 5000 5000 5000 5000 0 5000 0 5000 5000 0 5000 5000 5000 5000 0 0 5000 0 0 5000 0 5000 5000 0 0 0 5000 0 0 5000 0 5000 5000 0 0 0 5000 0 5000 5000 5000 0 0 5000 0 0 5000 5000 5000 5000 5000 0 5000 0 0 5000 0 5000 0 0 0 5000 5000 0 0 0 5000 5000 0 0 5000 0 5000 0 5000 0 0 0 0 0 5000 5000 5000 5000 0 5000 5000 0 0 5000 5000 0 0 5000 0 0 5000 0 0 5000 5000 5000 5000 5000 5000 0 0 5000 0 5000 0 0 0 0 0 0 5000 0 5000 5000 0 500...', 'output': ['2575933758']}, {'input': '104736\\r\\n0 5000 5000 5000 5000 0 5000 0 0 5000 0 0 5000 0 5000 5000 5000 5000 0 5000 0 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 5000 0 5000 5000 0 0 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 0 0 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 ...', 'output': ['409458801']}, {'input': '868160\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 500...', 'output': ['1683384246']}, {'input': '652655\\r\\n3334 3647 3955 1615 3535 4170 4440 916 3449 2474 1705 3926 4990 3602 1931 3593 1063 1637 3035 3592 4867 1381 2636 4148 2037 3053 2672 4117 3999 3410 3987 3809 1214 2506 4227 1035 3947 2980 4434 4606 1941 506 2430 4660 4704 2335 3672 659 3575 4897 2110 3191 1255 4677 4945 1118 1910 2386 928 630 4433 1229 3359 4875 1579 912 3160 2739 967 2438 4642 2192 4582 4089 4592 4265 2103 1404 4987 2649 601 4729 1050 1838 3316 964 4887 3663 1072 1898 921 2139 1880 4576 4828 3720 4421 1337 2919 4725 573 4563 714 ...', 'output': ['5470312646']}, {'input': '426079\\r\\n2838 696 521 2882 1816 4549 1788 4865 847 828 3444 3010 3490 4211 1926 2653 1094 2830 1268 3453 4906 532 2632 1988 2018 3161 2738 4149 3293 3844 3397 4545 2797 920 2672 2489 3556 1906 4249 662 2529 3906 1460 2151 1230 2527 1916 1727 1206 1011 1446 2586 4323 999 3917 3068 2849 2543 4319 3752 3258 2376 3342 4053 1804 1481 4853 2579 1163 2305 1735 4229 4686 2331 1992 3311 3851 1731 2098 2361 4830 941 3025 1566 3201 1692 2927 1751 4691 1394 3965 3014 1311 3986 1112 1710 3773 555 2357 2535 1687 1859 276...', 'output': ['3563797440']}, {'input': '199503\\r\\n819 819 4407 819 2634 1942 1127 819 1841 2488 819 819 774 4506 4800 1081 599 3091 819 819 4720 3629 819 819 2127 819 1115 819 819 819 819 819 819 819 2505 4087 2733 819 819 819 4835 2398 819 1588 819 2857 3465 819 4081 4347 3965 3529 2022 819 819 2856 819 819 1121 1828 819 819 2151 1524 2595 819 819 819 3629 3952 819 819 819 819 855 819 819 819 4197 819 2830 1026 2311 2606 819 819 4789 1104 2866 819 819 4562 2823 819 819 819 4389 819 3175 819 1115 819 819 819 819 819 3432 3480 819 3975 2524 3140 81...', 'output': ['1068954149']}, {'input': '615631\\r\\n3009 3663 3663 3663 2397 2553 3747 2143 2156 2962 3663 3826 4164 3663 3663 1309 1934 3663 4312 1760 1737 4296 3663 4739 3663 3663 3663 3663 4846 3663 3663 3663 986 2467 3663 3663 3663 3663 3663 2818 3663 3663 3663 3663 3663 3372 3663 3663 3663 4656 3663 3663 4912 3720 3663 3663 3663 4085 3663 3663 3663 4188 1082 4132 4775 1118 3663 3561 1043 3663 2132 4242 4604 3663 3663 3663 3663 3663 3663 3476 3663 2419 3349 3663 3663 3663 1120 3663 3663 3663 3663 2097 3663 4132 3663 4381 4692 3349 3663 3663 2768...', 'output': ['6032856551']}, {'input': '201235\\r\\n501 501 501 501 5000 501 501 501 501 5000 5000 501 501 501 501 501 5000 501 501 501 501 501 501 5000 501 5000 501 501 501 5000 501 501 501 501 501 5000 5000 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 5000 5000 501 5000 501 5000 5000 501 501 501 501 501 5000 501 501 501 5000 501 501 501 5000 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 5000 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 5...', 'output': ['422388015']}, {'input': '427811\\r\\n501 5000 501 501 501 501 501 5000 501 5000 501 501 501 501 5000 501 501 5000 501 501 501 5000 501 501 5000 501 5000 501 501 501 501 5000 501 501 501 501 5000 501 501 5000 501 501 501 501 5000 5000 5000 501 501 501 501 501 501 501 501 501 501 5000 501 501 5000 501 501 5000 501 5000 501 5000 501 5000 501 501 5000 501 501 501 5000 501 501 5000 501 5000 501 501 501 5000 5000 5000 501 501 501 5000 5000 5000 5000 501 501 501 501 501 501 5000 5000 501 501 501 5000 501 501 501 5000 501 501 501 5000 501 500...', 'output': ['1809031255']}, {'input': '462860\\r\\n501 501 5000 5000 5000 5000 501 5000 501 501 5000 501 5000 501 5000 5000 501 5000 501 501 501 5000 5000 501 5000 501 5000 5000 501 501 501 501 5000 5000 5000 5000 5000 501 5000 501 5000 501 501 501 5000 501 5000 5000 501 5000 5000 501 5000 5000 5000 501 501 5000 5000 5000 501 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 501 501 501 5000 5000 501 5000 501 501 501 5000 501 501 501 501 5000 501 5000 5000 501 501 501 5000 501 501 5000 501 501 5000 501 501 501 5000 501 5000 501 50...', 'output': ['3916819805']}, {'input': '236284\\r\\n5000 501 5000 5000 501 5000 5000 5000 5000 5000 5000 501 5000 501 501 5000 501 5000 501 5000 501 501 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 501 5000 501 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 501 501 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 501 501 501 5000 5000 5000 501 5000 5000 5000 501 501 5000 5000 5000 5000 501 501 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 501 5000 5000 501 5...', 'output': ['1003533735']}, {'input': '999708\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 500...', 'output': ['2120768420']}, {'input': '1000000\\r\\n48 8 20 45 21 24 8 0 42 18 16 5 49 40 18 22 40 43 41 47 30 15 17 36 25 9 24 29 8 33 29 41 22 5 15 40 21 18 13 49 39 4 38 3 24 36 27 39 9 5 0 38 40 16 42 27 24 10 12 50 41 19 3 19 34 12 42 18 2 7 17 22 11 20 25 48 18 16 25 49 19 34 21 37 4 46 16 21 9 22 1 48 28 27 36 3 49 41 43 48 36 39 8 14 38 0 18 11 37 31 23 12 14 16 38 41 47 14 45 29 34 44 32 13 17 26 44 12 46 50 37 39 40 49 30 11 22 43 19 50 32 27 30 20 28 10 24 2 17 34 12 37 36 29 26 37 21 48 4 11 31 7 30 46 15 6 0 44 47 40 24 10 33 48 33 48 ...', 'output': ['48889749']}, {'input': '1000000\\r\\n14 46 0 25 40 23 14 44 34 31 11 45 22 44 30 13 12 10 5 13 50 46 12 44 18 45 16 11 34 6 37 3 46 18 18 42 42 5 39 24 4 7 35 2 24 24 48 7 44 30 41 44 26 38 41 13 20 23 41 40 48 41 24 2 2 45 47 32 17 44 8 47 46 3 31 2 12 6 34 38 49 41 35 9 40 5 46 24 4 5 30 18 21 15 29 32 49 50 8 40 44 34 24 32 36 34 32 14 18 22 29 4 4 11 31 0 25 28 47 27 17 15 32 9 5 19 45 36 33 44 47 14 18 42 33 40 19 5 25 26 32 6 0 27 37 15 25 49 49 2 35 50 2 13 45 31 15 18 22 28 36 32 5 39 44 41 17 38 1 25 18 17 48 40 3 3 31 29 19...', 'output': ['48862349']}, {'input': '1000000\\r\\n2 27 42 2 2 2 2 4 17 47 2 45 17 2 2 2 2 14 2 42 2 5 15 37 4 5 37 40 2 2 14 17 48 2 2 2 2 37 2 2 46 8 2 45 24 47 29 35 2 2 15 2 2 12 2 34 2 2 43 2 2 23 19 49 2 42 2 3 2 2 2 2 0 5 2 2 2 37 2 2 2 2 3 2 29 2 36 22 50 2 2 43 2 2 2 34 14 1 10 2 19 33 40 3 2 50 21 41 35 13 0 18 18 2 2 2 2 29 21 2 7 2 2 36 8 2 2 2 38 21 30 30 12 2 38 41 2 42 2 16 2 2 43 38 2 42 2 2 2 14 2 2 2 8 15 2 2 5 31 49 41 2 2 29 2 2 2 32 14 2 18 2 2 23 2 2 2 2 2 41 32 2 2 29 2 2 2 21 2 2 2 2 2 24 25 13 2 2 32 2 17 2 2 11 2 21 2 29 ...', 'output': ['24924286']}, {'input': '1000000\\r\\n32 18 30 28 18 36 18 16 18 8 19 18 43 18 18 18 18 18 46 16 18 15 18 4 31 20 26 6 18 14 18 0 18 14 18 17 38 5 30 41 50 18 47 31 18 1 18 18 18 7 18 19 18 12 2 8 26 18 18 18 0 18 17 18 18 18 36 18 44 18 18 18 18 18 18 45 18 43 18 28 37 18 18 18 18 18 5 18 24 18 18 18 18 5 15 19 18 49 18 3 18 18 47 39 18 19 18 2 18 18 32 18 48 31 18 18 12 18 14 28 5 10 5 18 18 46 18 18 18 42 18 9 18 3 18 18 18 7 35 16 18 18 18 18 10 18 18 39 18 41 33 30 10 18 24 18 34 32 18 15 3 15 18 18 1 34 22 18 41 17 18 10 18 18 1...', 'output': ['39529186']}, {'input': '1000000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 50 0 0 0 0 0 0 0 0 0 50 0 0 0 50 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 0 50 0 50 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 0 0 0 0 50 0...', 'output': ['13477752']}, {'input': '1000000\\r\\n0 50 0 0 50 0 50 0 0 50 0 0 50 0 0 50 50 0 50 0 0 0 50 50 0 0 50 50 50 0 0 0 0 0 0 0 0 0 0 50 0 50 0 50 0 0 0 0 50 0 0 50 50 0 0 0 0 0 0 50 50 0 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 50 0 50 0 50 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 50 50 0 0 0 0 50 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 50 0 0 0 50 50 0 0 50 0 50 0 0 0 0 0 50 0 0 0 0 0 0 50 0 0 50 50 0 0 50 0 0 0 0 0 50 0 0 50 0 50 50 0 0 0 50 50 50 0 50 50 0 0 50 0 0 0 50 0 0 50 0 0 0 0 0...', 'output': ['26977860']}, {'input': '1000000\\r\\n50 50 50 50 50 50 0 50 0 0 0 0 0 0 0 0 50 50 50 0 0 0 50 0 0 0 0 50 0 0 50 50 50 50 50 50 0 0 50 50 0 0 0 50 0 0 0 0 50 50 0 0 50 50 50 50 50 0 0 0 0 0 50 50 0 50 0 50 0 50 0 50 0 50 0 0 0 50 0 50 0 0 50 0 50 0 0 50 0 50 0 0 50 50 0 50 0 0 50 0 0 0 0 0 50 0 50 50 0 0 0 0 0 0 0 50 0 0 0 0 0 0 50 50 0 50 0 50 50 0 0 50 50 50 50 50 0 50 0 50 50 50 0 0 0 50 0 0 0 50 50 0 0 50 0 50 50 0 0 0 50 50 0 0 0 50 50 50 0 50 50 0 50 0 0 50 50 50 50 50 50 50 0 50 0 50 50 0 50 50 0 50 50 50 50 50 50 50 0 0 50 0 5...', 'output': ['53993952']}, {'input': '1000000\\r\\n50 50 0 50 50 50 50 0 50 50 0 50 50 50 0 0 0 50 50 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 50 0 0 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 0 50 0 50 50 50 50 50 50 50 0 50 0 50 0 0 0 50 50 0 50 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 50 0 50 50 50 50 0 0 50 50 50 0 50 50 50 50 0 50 50 50 0 0 50 50 50 50 50 5...', 'output': ['26987364']}, {'input': '1000000\\r\\n50 50 50 50 0 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 0 0 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 0 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 ...', 'output': ['13460904']}, {'input': '1000000\\r\\n4928 5000 4744 3545 3738 2132 1318 4951 2071 1952 2436 3340 2119 2695 4938 4493 4798 575 4969 3520 2191 2873 1960 4032 3857 4548 2212 3864 2948 3089 4829 1148 1656 4725 1963 2766 1319 1971 2937 2979 3194 1866 4461 1519 3195 704 2802 4208 4242 937 1797 2331 3923 801 1677 1718 3754 770 1402 1801 3480 1839 3134 1069 4671 4776 3159 1728 2554 2091 751 626 2234 1416 640 610 1634 4110 4476 1075 2240 3216 3739 4099 4694 925 2824 3432 4434 4320 3411 4658 1378 2193 4301 2762 3768 3874 3815 3882 2439 2911 45...', 'output': ['8384253798']}, {'input': '1000000\\r\\n4637 1302 2880 1973 4301 4845 2403 2820 3359 1121 1066 3885 1101 1911 2875 865 3402 3883 1943 2415 4562 693 1895 2528 2203 2858 3316 3183 3462 3194 1180 667 3088 1856 2257 684 4941 599 1784 4124 2997 729 4662 2207 1177 4995 2535 1128 2688 4949 989 2888 3918 2059 2028 1444 2432 4254 2685 1889 2049 2391 2534 2133 3021 3290 4710 3200 1581 1147 4271 2676 2283 598 1333 1733 3408 1993 2692 2252 4442 1469 3112 960 2265 1455 4820 2984 4120 4641 1432 3231 3896 960 1817 1911 3379 1879 1417 2363 4263 1442 30...', 'output': ['8374983176']}, {'input': '1000000\\r\\n1616 3742 1616 1616 1616 1616 1787 4057 1616 710 4642 3132 1616 1616 1280 1616 3392 1680 1616 1202 2794 1616 714 1036 1616 666 1616 1616 2066 1616 4643 1616 1616 2370 1393 4716 1616 1616 4295 960 2721 3010 1616 1616 1616 3783 1616 3737 2293 1921 2932 3666 4864 1616 1616 3161 1933 1616 2214 4578 1616 1616 2040 2520 1616 1616 4641 1616 1150 1616 1616 896 3297 1616 1616 1185 4532 1616 2888 1616 1616 1616 1246 1616 1616 1616 1616 4534 1616 1616 1753 1174 1616 940 1616 1616 1616 1616 3180 1616 737 2174...', 'output': ['6573578424']}, {'input': '1000000\\r\\n2691 1471 1769 1769 1769 2426 1769 1769 1769 1603 1769 1769 1769 1769 510 1567 1524 1666 1769 1769 1153 1769 1769 1769 2414 1769 1074 1769 3210 2644 1201 3796 1766 1769 1644 577 1769 1918 1855 1769 3024 1769 1769 2995 1769 1769 4565 1769 3576 864 1769 1769 3337 1769 1769 1945 4876 2367 704 1769 1769 3704 1769 3168 1769 2401 1769 2844 1769 4175 2420 4683 1769 1769 1769 3560 1769 1769 1769 1769 1769 2808 1769 4057 4544 1769 1769 2697 2150 1737 2724 1769 3524 1769 1769 3502 1769 1769 1769 1769 1620 2...', 'output': ['6808525559']}, {'input': '1000000\\r\\n501 501 5000 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 5000 501 501 5000 501 501 5000 501 501 501 501 501 501 501 501 501 501...', 'output': ['2113787080']}, {'input': '1000000\\r\\n501 5000 5000 501 501 501 5000 501 5000 501 501 501 501 5000 501 501 5000 501 501 5000 501 501 501 501 501 501 501 5000 501 501 501 5000 501 5000 5000 501 501 501 501 501 5000 5000 501 501 501 501 501 501 501 501 501 501 5000 5000 501 501 5000 5000 501 5000 5000 501 501 5000 501 501 501 501 501 501 5000 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 5000 501 501 5000 501 5000 501 501 5000 501 5000 501 501 5000 501 501 501 501 501 501 5000 5000 501 501 501 5000 501 50...', 'output': ['4241621565']}, {'input': '1000000\\r\\n5000 501 501 5000 501 501 5000 501 501 5000 5000 5000 5000 5000 5000 501 5000 5000 501 501 5000 501 5000 5000 501 5000 501 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 501 5000 501 501 5000 501 5000 5000 501 5000 5000 501 5000 501 5000 5000 5000 5000 5000 501 5000 5000 5000 501 501 501 5000 501 501 501 501 5000 5000 5000 501 5000 501 5000 5000 5000 501 5000 501 501 501 5000 5000 501 5000 501 5000 5000 5000 501 5000 501 501 5000 5000 5000 501 5000 501 5000 5000 501 ...', 'output': ['8464722245']}, {'input': '1000000\\r\\n5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 501 5000 5000 501 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 501 5000 501 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 501 501 5000 5000 5000 5000 5000 5000 501 501 5000 5000 501 5000 5000 501 5000 501 501 501 5000 5000 501 5000 5000 5000 501 5000 5000 501 5000 5000 501 501 5000 5000 5000 5000 5000 5000 5000 501 501 501 501 5000 501 5000 ...', 'output': ['4229505890']}, {'input': '1000000\\r\\n501 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 501 5000 5000 5000 5000 501 5000 5000 501 5000 5000 5000 5000 501 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 501 5000 500...', 'output': ['2122852655']}, {'input': '1000000\\r\\n3491 3862 4899 1602 3307 2481 2146 1000 2479 2072 1534 2587 3924 4181 4835 2449 1976 4441 2217 3227 3297 2989 1754 1498 3742 1437 3766 3234 1072 3972 2514 1055 3883 4655 3452 1827 1874 1349 3202 2450 2946 3550 3879 3214 3123 2445 3893 1771 4218 3032 1325 4404 1421 1531 3754 1412 3178 4801 3290 4438 3677 4018 3175 1981 3353 3939 1512 3645 3759 3630 3769 3848 2031 1011 1771 1278 3021 2768 4761 1697 3561 4706 1464 3090 4827 1058 1120 3602 1808 2849 2244 4170 1928 3584 4395 2628 3674 1812 4074 1723 35...', 'output': ['8999391475']}, {'input': '1000000\\r\\n4525 1819 4273 3463 1648 2372 4978 2585 2374 2402 3570 2924 1135 1647 4411 924 1539 2671 1396 1592 2253 3152 2052 4858 4538 2952 1123 1441 2052 2404 2073 4052 4954 1331 4834 2353 1980 3243 4991 1389 2920 2050 1337 3188 2953 2753 2451 2119 3315 2174 3910 3759 3410 4935 2996 1728 1229 1070 1719 3715 2233 1699 3794 1656 4410 4356 3740 4240 4249 3772 2740 3670 3711 4863 1584 4255 1217 3831 4379 2230 2132 1625 3418 1469 4672 4632 1416 979 1173 3364 1419 1460 3118 3410 1250 1531 4916 3057 4448 4483 3900...', 'output': ['9003221879']}, {'input': '1000000\\r\\n1442 3254 3079 1274 4816 1653 3079 3079 3079 1396 4595 2894 3079 3079 1060 3079 4646 3079 3079 3567 3079 3079 3079 1111 2788 3079 913 3020 1455 3026 3079 3079 4799 3079 1018 3079 3079 3079 3079 2703 4596 3079 3079 3079 3079 3790 4649 3079 3079 3803 1425 3079 1956 3886 3861 3663 3079 3121 2774 2577 4524 3079 3079 1760 3079 3079 3545 3079 3079 3079 1009 3079 3775 4972 4066 3079 1602 3079 1288 3079 3079 3079 3079 3079 3079 1482 3079 3079 3079 3079 3079 2153 3079 1233 4758 1729 3079 1361 2370 3522 119...', 'output': ['9192195816']}, {'input': '1000000\\r\\n3085 4754 3064 4924 4924 3593 3916 3300 4924 2820 3819 4924 2825 2127 4924 3321 3323 4924 2612 4924 4924 4924 4924 4924 2572 4357 4924 4924 1690 4012 3790 4924 4924 4924 4924 2601 1049 4032 3940 4651 3530 4924 2765 2847 3710 2400 3405 2217 4924 4924 4546 1228 4924 4924 2806 4900 1510 4924 4924 4924 4924 3746 2527 4475 3412 4924 4924 4133 4924 4924 4924 3474 4924 4924 1006 4924 4924 1683 2651 2822 2382 2521 3814 4924 2554 4924 4215 3787 4685 2481 3981 4924 4924 3234 4112 4924 1758 4924 4924 4924 37...', 'output': ['12154389312']}, {'input': '4\\r\\n13 14 15 16\\r\\n', 'output': ['76']}, {'input': '3\\r\\n1 5 6\\r\\n', 'output': ['10']}, {'input': '3\\r\\n15 13 2\\r\\n', 'output': ['42']}, {'input': '3\\r\\n1 8 9\\r\\n', 'output': ['20']}, {'input': '3\\r\\n2 5 6\\r\\n', 'output': ['11']}]","id":91} {"description":"This problem is same as the next one, but has smaller constraints.It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station, the cats got impressed with a large power transmission system consisting of many chimneys, electric poles, and wires. Since they are cats, they found those things gigantic.At the entrance of the station, there is a map describing the complicated wiring system. Selena is the best at math among three friends. He decided to draw the map on the Cartesian plane. Each pole is now a point at some coordinates $$$(x_i, y_i)$$$. Since every pole is different, all of the points representing these poles are distinct. Also, every two poles are connected with each other by wires. A wire is a straight line on the plane infinite in both directions. If there are more than two poles lying on the same line, they are connected by a single common wire.Selena thinks, that whenever two different electric wires intersect, they may interfere with each other and cause damage. So he wonders, how many pairs are intersecting? Could you help him with this problem?","input_specification":"The first line contains a single integer $$$n$$$ ($$$2 \\le n \\le 50$$$)\u00a0\u2014 the number of electric poles. Each of the following $$$n$$$ lines contains two integers $$$x_i$$$, $$$y_i$$$ ($$$-10^4 \\le x_i, y_i \\le 10^4$$$)\u00a0\u2014 the coordinates of the poles. It is guaranteed that all of these $$$n$$$ points are distinct.","output_specification":"Print a single integer\u00a0\u2014 the number of pairs of wires that are intersecting.","notes":"NoteIn the first example: In the second example: Note that the three poles $$$(0, 0)$$$, $$$(0, 2)$$$ and $$$(0, 4)$$$ are connected by a single wire.In the third example: ","sample_inputs":["4\n0 0\n1 1\n0 3\n1 2","4\n0 0\n0 2\n0 4\n2 0","3\n-1 -1\n1 0\n3 1"],"sample_outputs":["14","6","0"],"src_uid":"8c2e0cd780cf9390e933e28e57643cba","lang_cluster":"Java","difficulty":1900,"human_solution":"import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic final class Solution {\n\n private final static boolean USE_FILE_IO = false;\n\n Reader reader;\n Writer writer;\n\n Solution(Reader reader, Writer writer) {\n this.reader = reader;\n this.writer = writer;\n }\n\n long solve() throws java.lang.Exception {\n int n = reader.nextInt();\n int[] x = new int[n];\n int[] y = new int[n];\n for (int i=0; i slopes = new HashMap();\n HashSet lines = new HashSet();\n for (int i=0; i stack = new Stack<>();\n for (int i=0; i stack.peek()){\n stack.add(arr[i]);\n } else if (arr[i] == stack.peek())\n stack.pop();\n else stack.add(arr[i]);\n }\n }\n if (stack.size() > 1){\n return 0;\n }\n return 1;\n }\n \n}","testcases":"[{'input': '5\\r\\n2 1 1 2 5\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3\\r\\n4 5 3\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n10 10\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3\\r\\n1 2 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10\\r\\n1 9 7 6 2 4 7 8 1 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '1\\r\\n2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3\\r\\n2 1 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n1 2 2 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '5\\r\\n5 2 5 2 6\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n3 3 3 4\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3\\r\\n1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '5\\r\\n2 1 1 2 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2\\r\\n99999999 99999998\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n1 1 2 1 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n1 2 2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n1 2 2 2 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6\\r\\n3 3 4 4 3 4\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n2 10 6 9 4\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7\\r\\n10 2 3 4 2 8 8\\r\\n', 'output': ['YES\\r\\n']}, {'input': '9\\r\\n2 5 1 9 6 5 7 3 1\\r\\n', 'output': ['NO\\r\\n']}]","id":93} {"description":"Polycarp's workday lasts exactly $$$n$$$ minutes. He loves chocolate bars and can eat one bar in one minute. Today Polycarp has $$$k$$$ bars at the beginning of the workday.In some minutes of the workday Polycarp has important things to do and in such minutes he is not able to eat a chocolate bar. In other minutes he can either eat or not eat one chocolate bar. It is guaranteed, that in the first and in the last minutes of the workday Polycarp has no important things to do and he will always eat bars in this minutes to gladden himself at the begining and at the end of the workday. Also it is guaranteed, that $$$k$$$ is strictly greater than $$$1$$$.Your task is to determine such an order of eating chocolate bars that the maximum break time between eating bars is as minimum as possible.Consider that Polycarp eats a bar in the minute $$$x$$$ and the next bar in the minute $$$y$$$ ($$$x < y$$$). Then the break time is equal to $$$y - x - 1$$$ minutes. It is not necessary for Polycarp to eat all bars he has.","input_specification":"The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \\le n \\le 200\\,000$$$, $$$2 \\le k \\le n$$$) \u2014 the length of the workday in minutes and the number of chocolate bars, which Polycarp has in the beginning of the workday. The second line contains the string with length $$$n$$$ consisting of zeros and ones. If the $$$i$$$-th symbol in the string equals to zero, Polycarp has no important things to do in the minute $$$i$$$ and he can eat a chocolate bar. In the other case, Polycarp is busy in the minute $$$i$$$ and can not eat a chocolate bar. It is guaranteed, that the first and the last characters of the string are equal to zero, and Polycarp always eats chocolate bars in these minutes.","output_specification":"Print the minimum possible break in minutes between eating chocolate bars.","notes":"NoteIn the first example Polycarp can not eat the chocolate bar in the second minute, so the time of the break equals to one minute.In the second example Polycarp will eat bars in the minutes $$$1$$$ and $$$8$$$ anyway, also he needs to eat the chocolate bar in the minute $$$5$$$, so that the time of the maximum break will be equal to $$$3$$$ minutes.","sample_inputs":["3 3\n010","8 3\n01010110"],"sample_outputs":["1","3"],"src_uid":"e33b0a752dc1aba25da21e20435e3fe2","lang_cluster":"Java","difficulty":2000,"human_solution":"import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int k = sc.nextInt();\n String abil = sc.nextLine();\n abil = sc.nextLine();\n ArrayList pos = new ArrayList<>();\n for(int i = 1; i < abil.length(); ++i)\n if (abil.charAt(i) == '0')\n pos.add(i);\n int l = -1, r = n+1;\n while (r - l > 1)\n {\n int m = (l + r) \/ 2;\n int last = 0;\n int left = k - 1;\n boolean ok = true;\n for(int i = 0; i < pos.size(); ++i)\n if (i == pos.size()-1 || last + m + 1 < pos.get(i+1))\n {\n ok = ok && pos.get(i) - last <= m+1;\n last = pos.get(i);\n --left;\n }\n if (left < 0 || !ok)\n l = m;\n else\n r = m;\n }\n System.out.println(r);\n }\n}\n","testcases":"[{'input': '3 3\\r\\n010\\r\\n', 'output': ['1\\r\\n']}, {'input': '8 3\\r\\n01010110\\r\\n', 'output': ['3\\r\\n']}, {'input': '9 5\\r\\n001100110\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 2\\r\\n00\\r\\n', 'output': ['0\\r\\n']}, {'input': '3 2\\r\\n010\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 2\\r\\n000\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 3\\r\\n000\\r\\n', 'output': ['0\\r\\n']}, {'input': '4 2\\r\\n0000\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 2\\r\\n0100\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 2\\r\\n0010\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 2\\r\\n0110\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 3\\r\\n0000\\r\\n', 'output': ['1\\r\\n']}, {'input': '4 3\\r\\n0010\\r\\n', 'output': ['1\\r\\n']}, {'input': '4 3\\r\\n0100\\r\\n', 'output': ['1\\r\\n']}, {'input': '4 3\\r\\n0110\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 4\\r\\n0000\\r\\n', 'output': ['0\\r\\n']}, {'input': '4 4\\r\\n0100\\r\\n', 'output': ['1\\r\\n']}, {'input': '4 4\\r\\n0010\\r\\n', 'output': ['1\\r\\n']}, {'input': '4 4\\r\\n0110\\r\\n', 'output': ['2\\r\\n']}, {'input': '10 3\\r\\n0111011010\\r\\n', 'output': ['4\\r\\n']}, {'input': '100 19\\r\\n0011011110011111111010111101101100101111111111011011111111110111101111101111111101111011111011101110\\r\\n', 'output': ['10\\r\\n']}, {'input': '10 3\\r\\n0111011010\\r\\n', 'output': ['4\\r\\n']}, {'input': '100 19\\r\\n0011011110011111111010111101101100101111111111011011111111110111101111101111111101111011111011101110\\r\\n', 'output': ['10\\r\\n']}, {'input': '10 6\\r\\n0000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '10 4\\r\\n0000001000\\r\\n', 'output': ['3\\r\\n']}, {'input': '10 6\\r\\n0000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 21\\r\\n0110111011000010010101011101110101110111000111101011110100011011100011111101001010001111001111111000\\r\\n', 'output': ['7\\r\\n']}, {'input': '10 9\\r\\n0111011010\\r\\n', 'output': ['3\\r\\n']}, {'input': '100 89\\r\\n0011011110011111111010111101101100101111111111011011111111110111101111101111111101111011111011101110\\r\\n', 'output': ['10\\r\\n']}, {'input': '10 6\\r\\n0000000000\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 81\\r\\n0110111011000010010101011101110101110111000111101011110100011011100011111101001010001111001111111000\\r\\n', 'output': ['7\\r\\n']}]","id":94} {"description":"In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network\u00a0\u2014 for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one railway or one road always takes exactly one hour.A train and a bus leave town 1 at the same time. They both have the same destination, town n, and don't make any stops on the way (but they can wait in town n). The train can move only along railways and the bus can move only along roads.You've been asked to plan out routes for the vehicles; each route can use any road\/railway multiple times. One of the most important aspects to consider is safety\u00a0\u2014 in order to avoid accidents at railway crossings, the train and the bus must not arrive at the same town (except town n) simultaneously.Under these constraints, what is the minimum number of hours needed for both vehicles to reach town n (the maximum of arrival times of the bus and the train)? Note, that bus and train are not required to arrive to the town n at the same moment of time, but are allowed to do so.","input_specification":"The first line of the input contains two integers n and m (2\u2009\u2264\u2009n\u2009\u2264\u2009400, 0\u2009\u2264\u2009m\u2009\u2264\u2009n(n\u2009-\u20091)\u2009\/\u20092)\u00a0\u2014 the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1\u2009\u2264\u2009u,\u2009v\u2009\u2264\u2009n, u\u2009\u2260\u2009v). You may assume that there is at most one railway connecting any two towns.","output_specification":"Output one integer\u00a0\u2014 the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output \u2009-\u20091.","notes":"NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4.","sample_inputs":["4 2\n1 3\n3 4","4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4","5 5\n4 2\n3 5\n4 5\n5 1\n1 2"],"sample_outputs":["2","-1","3"],"src_uid":"fbfc333ad4b0a750f654a00be84aea67","lang_cluster":"Java","difficulty":1600,"human_solution":"import java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.text.*;\n\n\/* Name of the class has to be \"Main\" only if the class is public*\/\npublic class CF602C\n{\n static class FastReader {\n \n BufferedReader br;\n StringTokenizer st;\n \n public FastReader() {\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n \n int nextInt() {\n return Integer.parseInt(next());\n }\n \n long nextLong() {\n return Long.parseLong(next());\n }\n \n double nextDouble() {\n return Double.parseDouble(next());\n }\n \n String nextLine() {\n String str = \"\";\n try {\n str = br.readLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return str;\n }\n }\n \n static class Node {\n \n long pp;\n long a, b;\n \n Node(long x, long y) {\n a = x;\n b = y;\n pp = a * b;\n }\n }\n static class Comp implements Comparator {\n \n public int compare(Node o1, Node o2) {\n if (o1.pp > o2.pp) {\n return 1;\n } else {\n return -1;\n }\n }\n }\n public static void main(String[] args) {\n FastReader sc=new FastReader();\n PrintWriter out=new PrintWriter(System.out);\n \/\/your code starts here\n int n=sc.nextInt();\n boolean adj[][]=new boolean[n][n];\n int m=sc.nextInt();\n for(int i=0;i q=new LinkedList();\n q.add(0); \n while(!q.isEmpty())\n {\n int s=q.poll();\n for(int i=0;i 0)\n\t\t\t\tpp[a]++;\n\t\t\telse {\n\t\t\t\tqq[-a]++;\n\t\t\t\tq++;\n\t\t\t}\n\t\t}\n\t\tboolean[] yes = new boolean[n + 1];\n\t\tint k = 0;\n\t\tfor (int a = 1; a <= n; a++)\n\t\t\tif (pp[a] + q - qq[a] == m) {\n\t\t\t\tyes[a] = true;\n\t\t\t\tk++;\n\t\t\t}\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint a = aa[i];\n\t\t\tif (a > 0)\n\t\t\t\tprintln(yes[a] ? (k == 1 ? \"Truth\" : \"Not defined\") : \"Lie\");\n\t\t\telse\n\t\t\t\tprintln(yes[-a] ? (k == 1 ? \"Lie\" : \"Not defined\") : \"Truth\");\n\t\t}\n\t}\n}\n","testcases":"[{'input': '1 1\\r\\n+1\\r\\n', 'output': ['Truth\\r\\n']}, {'input': '3 2\\r\\n-1\\r\\n-2\\r\\n-3\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '4 1\\r\\n+2\\r\\n-3\\r\\n+4\\r\\n-1\\r\\n', 'output': ['Lie\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\n']}, {'input': '1 0\\r\\n-1\\r\\n', 'output': ['Lie\\r\\n']}, {'input': '2 2\\r\\n+1\\r\\n+1\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\n']}, {'input': '2 1\\r\\n+2\\r\\n+1\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\n']}, {'input': '2 0\\r\\n-2\\r\\n-2\\r\\n', 'output': ['Lie\\r\\nLie\\r\\n']}, {'input': '3 1\\r\\n+2\\r\\n+3\\r\\n+3\\r\\n', 'output': ['Truth\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '6 3\\r\\n+5\\r\\n+5\\r\\n+5\\r\\n+1\\r\\n+1\\r\\n+1\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '4 3\\r\\n-4\\r\\n-3\\r\\n-1\\r\\n-3\\r\\n', 'output': ['Not defined\\r\\nTruth\\r\\nNot defined\\r\\nTruth\\r\\n']}, {'input': '10 4\\r\\n-8\\r\\n+1\\r\\n-6\\r\\n-10\\r\\n+5\\r\\n-6\\r\\n-8\\r\\n-8\\r\\n-4\\r\\n-8\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n-4\\r\\n+4\\r\\n+4\\r\\n-9\\r\\n-9\\r\\n-4\\r\\n-4\\r\\n+2\\r\\n-9\\r\\n-4\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '7 2\\r\\n+5\\r\\n+5\\r\\n+5\\r\\n-2\\r\\n+1\\r\\n-5\\r\\n-6\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\n']}, {'input': '7 4\\r\\n+7\\r\\n-3\\r\\n-3\\r\\n-4\\r\\n+3\\r\\n+3\\r\\n+3\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '6 3\\r\\n-6\\r\\n-1\\r\\n+5\\r\\n+1\\r\\n+6\\r\\n+1\\r\\n', 'output': ['Truth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\n']}, {'input': '5 3\\r\\n-2\\r\\n+2\\r\\n+2\\r\\n-3\\r\\n+5\\r\\n', 'output': ['Not defined\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\n']}, {'input': '3 0\\r\\n-2\\r\\n-2\\r\\n-2\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '5 3\\r\\n-1\\r\\n-1\\r\\n-4\\r\\n+1\\r\\n-4\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '9 6\\r\\n+2\\r\\n+7\\r\\n+7\\r\\n-1\\r\\n-4\\r\\n+7\\r\\n-7\\r\\n+7\\r\\n+5\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '43 18\\r\\n-14\\r\\n-28\\r\\n+16\\r\\n+10\\r\\n+25\\r\\n-30\\r\\n+25\\r\\n+30\\r\\n+25\\r\\n+25\\r\\n+25\\r\\n+25\\r\\n-25\\r\\n+22\\r\\n+3\\r\\n-17\\r\\n+16\\r\\n-25\\r\\n+10\\r\\n+14\\r\\n+41\\r\\n+25\\r\\n-25\\r\\n+33\\r\\n+24\\r\\n-23\\r\\n-25\\r\\n+25\\r\\n-22\\r\\n+29\\r\\n+28\\r\\n-25\\r\\n-25\\r\\n-29\\r\\n+11\\r\\n+26\\r\\n-25\\r\\n+25\\r\\n+10\\r\\n+1\\r\\n-20\\r\\n-17\\r\\n+23\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '28 12\\r\\n+10\\r\\n-7\\r\\n+17\\r\\n-20\\r\\n+7\\r\\n-7\\r\\n+13\\r\\n-21\\r\\n-7\\r\\n-7\\r\\n-18\\r\\n+7\\r\\n+7\\r\\n+3\\r\\n+6\\r\\n+14\\r\\n+7\\r\\n-24\\r\\n-21\\r\\n-7\\r\\n-7\\r\\n+4\\r\\n+7\\r\\n-7\\r\\n+21\\r\\n-7\\r\\n-26\\r\\n+7\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '17 9\\r\\n-6\\r\\n+16\\r\\n+5\\r\\n+16\\r\\n-17\\r\\n+17\\r\\n-11\\r\\n+5\\r\\n+14\\r\\n+5\\r\\n-8\\r\\n-5\\r\\n+6\\r\\n-2\\r\\n-11\\r\\n+4\\r\\n+17\\r\\n', 'output': ['Truth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '14 3\\r\\n+14\\r\\n+12\\r\\n-9\\r\\n+9\\r\\n-9\\r\\n-9\\r\\n+8\\r\\n+9\\r\\n+2\\r\\n+1\\r\\n-13\\r\\n-9\\r\\n+13\\r\\n+3\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 4\\r\\n-9\\r\\n-8\\r\\n-5\\r\\n-9\\r\\n-7\\r\\n-9\\r\\n-9\\r\\n-9\\r\\n-4\\r\\n-9\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-5\\r\\n-1\\r\\n+10\\r\\n-3\\r\\n-10\\r\\n-9\\r\\n-10\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 4\\r\\n-3\\r\\n-3\\r\\n-3\\r\\n-3\\r\\n-3\\r\\n-2\\r\\n-2\\r\\n-6\\r\\n-7\\r\\n-3\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 6\\r\\n-9\\r\\n-7\\r\\n-5\\r\\n-5\\r\\n-4\\r\\n-2\\r\\n-8\\r\\n-5\\r\\n-5\\r\\n-9\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 4\\r\\n-8\\r\\n-2\\r\\n-8\\r\\n+1\\r\\n-4\\r\\n-8\\r\\n-2\\r\\n-8\\r\\n-8\\r\\n-1\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 2\\r\\n-8\\r\\n+10\\r\\n+1\\r\\n+8\\r\\n+4\\r\\n+8\\r\\n+6\\r\\n-8\\r\\n+10\\r\\n+1\\r\\n', 'output': ['Not defined\\r\\nLie\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nNot defined\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 3\\r\\n+9\\r\\n+3\\r\\n+8\\r\\n+3\\r\\n+6\\r\\n-3\\r\\n+6\\r\\n+8\\r\\n+3\\r\\n+7\\r\\n', 'output': ['Lie\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\nLie\\r\\n']}, {'input': '10 8\\r\\n-2\\r\\n+9\\r\\n+9\\r\\n-4\\r\\n+9\\r\\n+9\\r\\n+4\\r\\n-9\\r\\n-3\\r\\n+9\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '10 7\\r\\n-4\\r\\n+6\\r\\n+4\\r\\n+9\\r\\n+6\\r\\n+6\\r\\n+6\\r\\n+6\\r\\n+6\\r\\n+2\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 4\\r\\n+3\\r\\n+5\\r\\n+6\\r\\n+10\\r\\n+5\\r\\n+5\\r\\n+6\\r\\n+8\\r\\n+5\\r\\n+6\\r\\n', 'output': ['Lie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 7\\r\\n-6\\r\\n-10\\r\\n-3\\r\\n-1\\r\\n-3\\r\\n-7\\r\\n-2\\r\\n-7\\r\\n-7\\r\\n-3\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nTruth\\r\\nNot defined\\r\\nNot defined\\r\\nNot defined\\r\\n']}, {'input': '10 5\\r\\n-4\\r\\n-4\\r\\n-1\\r\\n-5\\r\\n-7\\r\\n-4\\r\\n-4\\r\\n-4\\r\\n-1\\r\\n-7\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '10 5\\r\\n-9\\r\\n-7\\r\\n-6\\r\\n-3\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-2\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 3\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-3\\r\\n-10\\r\\n-10\\r\\n-10\\r\\n-8\\r\\n-4\\r\\n-10\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n-8\\r\\n-8\\r\\n-4\\r\\n-9\\r\\n-10\\r\\n-2\\r\\n-9\\r\\n-8\\r\\n-8\\r\\n-8\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 5\\r\\n+7\\r\\n+8\\r\\n+9\\r\\n+1\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+6\\r\\n+6\\r\\n+7\\r\\n', 'output': ['Truth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 5\\r\\n+2\\r\\n+2\\r\\n+2\\r\\n+2\\r\\n+9\\r\\n+10\\r\\n+8\\r\\n+7\\r\\n+4\\r\\n+2\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\n']}, {'input': '10 9\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n+5\\r\\n+7\\r\\n+7\\r\\n+7\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nTruth\\r\\n']}, {'input': '10 3\\r\\n+10\\r\\n+2\\r\\n+10\\r\\n+9\\r\\n+1\\r\\n+9\\r\\n+4\\r\\n+9\\r\\n+3\\r\\n+2\\r\\n', 'output': ['Lie\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\n']}, {'input': '10 6\\r\\n+10\\r\\n+10\\r\\n+10\\r\\n+3\\r\\n+10\\r\\n+10\\r\\n+6\\r\\n+6\\r\\n+10\\r\\n+8\\r\\n', 'output': ['Truth\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nTruth\\r\\nTruth\\r\\nLie\\r\\nLie\\r\\nTruth\\r\\nLie\\r\\n']}, {'input': '3 2\\r\\n-1\\r\\n+2\\r\\n+3\\r\\n', 'output': ['Truth\\r\\nNot defined\\r\\nNot defined\\r\\n']}]","id":97} {"description":"It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe didn't switch the last security system off. On the plus side, he knows the way it works.Every minute the security system calculates the total amount of diamonds for each two adjacent cells (for the cells between whose numbers difference equals 1). As a result of this check we get an n\u2009-\u20091 sums. If at least one of the sums differs from the corresponding sum received during the previous check, then the security system is triggered.Joe can move the diamonds from one cell to another between the security system's checks. He manages to move them no more than m times between two checks. One of the three following operations is regarded as moving a diamond: moving a diamond from any cell to any other one, moving a diamond from any cell to Joe's pocket, moving a diamond from Joe's pocket to any cell. Initially Joe's pocket is empty, and it can carry an unlimited amount of diamonds. It is considered that before all Joe's actions the system performs at least one check.In the morning the bank employees will come, which is why Joe has to leave the bank before that moment. Joe has only k minutes left before morning, and on each of these k minutes he can perform no more than m operations. All that remains in Joe's pocket, is considered his loot.Calculate the largest amount of diamonds Joe can carry with him. Don't forget that the security system shouldn't be triggered (even after Joe leaves the bank) and Joe should leave before morning.","input_specification":"The first line contains integers n, m and k (1\u2009\u2264\u2009n\u2009\u2264\u2009104, 1\u2009\u2264\u2009m,\u2009k\u2009\u2264\u2009109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell \u2014 it is an integer from 0 to 105.","output_specification":"Print a single number \u2014 the maximum number of diamonds Joe can steal.","notes":"NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference and the security system doesn't go off.During the second period Joe moves a diamond from the 3-rd cell to the 2-nd one and puts a diamond from the 1-st cell to his pocket.By the end of the second period the diamonds' positions are 2 3 1. The check finds no difference again and the security system doesn't go off.Now Joe leaves with 2 diamonds in his pocket.","sample_inputs":["2 3 1\n2 3","3 2 2\n4 1 3"],"sample_outputs":["0","2"],"src_uid":"b81e7a786e4083cf7188f718bc045a85","lang_cluster":"Java","difficulty":1800,"human_solution":"import java.io.*;\nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\n public static void main(String[] args) throws IOException {\n Scanner sc = new Scanner(System.in);\n PrintWriter out = new PrintWriter(System.out);\n int n = sc.nextInt();\n int m = sc.nextInt();\n int k = sc.nextInt();\n int[] a = sc.nextIntArray(n);\n if (n % 2 == 0) {\n System.out.println(0);\n return;\n }\n int min = (int) (1e5 + 10);\n for (int i = 0; i < n; i += 2)\n min = Math.min(min, a[i]);\n int y = n \/ 2 + 1;\n out.println(Math.min(min, 1l * k * (m \/ y)));\n out.flush();\n out.close();\n }\n\n static class Scanner {\n StringTokenizer st;\n BufferedReader br;\n\n public Scanner(InputStream system) {\n br = new BufferedReader(new InputStreamReader(system));\n }\n\n\n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());\n return st.nextToken();\n }\n\n public String nextLine() throws IOException {\n return br.readLine();\n }\n\n public int nextInt() throws IOException {\n return Integer.parseInt(next());\n }\n\n public double nextDouble() throws IOException {\n return Double.parseDouble(next());\n }\n\n public char nextChar() throws IOException {\n return next().charAt(0);\n }\n\n public Long nextLong() throws IOException {\n return Long.parseLong(next());\n }\n\n public boolean ready() throws IOException {\n return br.ready();\n }\n\n\n public int[] nextIntArray(int n) throws IOException {\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public long[] nextLongArray(int n) throws IOException {\n long[] a = new long[n];\n for (int i = 0; i < n; i++)\n a[i] = nextLong();\n return a;\n }\n\n\n public Integer[] nextIntegerArray(int n) throws IOException {\n Integer[] a = new Integer[n];\n for (int i = 0; i < n; i++)\n a[i] = nextInt();\n return a;\n }\n\n public double[] nextDoubleArray(int n) throws IOException {\n double[] ans = new double[n];\n for (int i = 0; i < n; i++)\n ans[i] = nextDouble();\n return ans;\n }\n\n public short nextShort() throws IOException {\n return Short.parseShort(next());\n }\n\n }\n\n}","testcases":"[{'input': '2 3 1\\r\\n2 3\\r\\n', 'output': ['0']}, {'input': '3 2 2\\r\\n4 1 3\\r\\n', 'output': ['2']}, {'input': '5 10 10\\r\\n7 0 7 0 7\\r\\n', 'output': ['7']}, {'input': '6 10 4\\r\\n1 2 3 4 5 6\\r\\n', 'output': ['0']}, {'input': '7 5 2\\r\\n1 2 3 4 5 6 7\\r\\n', 'output': ['1']}, {'input': '16 100 100\\r\\n30 89 12 84 62 24 10 59 98 21 13 69 65 12 54 32\\r\\n', 'output': ['0']}, {'input': '99 999 999\\r\\n9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['9']}, {'input': '1 1 1\\r\\n0\\r\\n', 'output': ['0']}, {'input': '1 64 25\\r\\n100000\\r\\n', 'output': ['1600']}, {'input': '1 1000000000 1\\r\\n100\\r\\n', 'output': ['100']}, {'input': '1 1 1000000000\\r\\n100\\r\\n', 'output': ['100']}, {'input': '1 1000000000 1000000000\\r\\n100\\r\\n', 'output': ['100']}, {'input': '5 2 9494412\\r\\n5484 254 1838 18184 9421\\r\\n', 'output': ['0']}, {'input': '5 10 7\\r\\n98765 78654 25669 45126 98745\\r\\n', 'output': ['21']}, {'input': '13 94348844 381845400\\r\\n515 688 5464 155 441 9217 114 21254 55 9449 1800 834 384\\r\\n', 'output': ['55']}, {'input': '17 100 100\\r\\n47 75 22 18 42 53 95 98 94 50 63 55 46 80 9 20 99\\r\\n', 'output': ['9']}, {'input': '47 20 1000000\\r\\n81982 19631 19739 13994 50426 14232 79125 95908 20227 79428 84065 86233 30742 82664 54626 10849 11879 67198 15667 75866 47242 90766 23115 20130 37293 8312 57308 52366 49768 28256 56085 39722 40397 14166 16743 28814 40538 50753 60900 99449 94318 54247 10563 5260 76407 42235 417\\r\\n', 'output': ['0']}, {'input': '58 5858758 7544547\\r\\n6977 5621 6200 6790 7495 5511 6214 6771 6526 6557 5936 7020 6925 5462 7519 6166 5974 6839 6505 7113 5674 6729 6832 6735 5363 5817 6242 7465 7252 6427 7262 5885 6327 7046 6922 5607 7238 5471 7145 5822 5465 6369 6115 5694 6561 7330 7089 7397 7409 7093 7537 7279 7613 6764 7349 7095 6967 5984\\r\\n', 'output': ['0']}, {'input': '79 5464 64574\\r\\n3800 2020 2259 503 4922 975 5869 6140 3808 2635 3420 992 4683 3748 5732 4787 6564 3302 6153 4955 2958 6107 2875 3449 1755 5029 5072 5622 2139 1892 4640 1199 3918 1061 4074 5098 4939 5496 2019 356 5849 4796 4446 4633 1386 1129 3351 639 2040 3769 4106 4048 3959 931 3457 1938 4587 6438 2938 132 2434 3727 3926 2135 1665 2871 2798 6359 989 6220 97 2116 2048 251 4264 3841 4428 5286 1914\\r\\n', 'output': ['97']}, {'input': '95 97575868 5\\r\\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 6259 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3372 6394 6423 3728 3720 6525 4296 2091 4400 994 1321 3454 5285 2989 1755 504 5019 2629 3834 3191 6254 844 5338 615 5608 4898 2497 4482 850 5308 2763 1943 6515 5459 5556 829 4646 5258 2019 5582 1226\\r\\n', 'output': ['815']}, {'input': '77 678686 878687\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['1']}, {'input': '2 7597 8545\\r\\n74807 22362\\r\\n', 'output': ['0']}, {'input': '3 75579860 8570575\\r\\n10433 30371 14228\\r\\n', 'output': ['10433']}]","id":98} {"description":"Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does not always adopt new hobbies, one can quit something as well.This time Igor K. got disappointed in one of his hobbies: editing and voicing videos. Moreover, he got disappointed in it so much, that he decided to destroy his secret archive for good. Igor K. use Pindows XR operation system which represents files and folders by small icons. At that, m icons can fit in a horizontal row in any window.Igor K.'s computer contains n folders in the D: disk's root catalog. The folders are numbered from 1 to n in the order from the left to the right and from top to bottom (see the images). At that the folders with secret videos have numbers from a to b inclusive. Igor K. wants to delete them forever, at that making as few frame selections as possible, and then pressing Shift+Delete exactly once. What is the minimum number of times Igor K. will have to select the folder in order to select folders from a to b and only them? Let us note that if some selected folder is selected repeatedly, then it is deselected. Each selection possesses the shape of some rectangle with sides parallel to the screen's borders.","input_specification":"The only line contains four integers n, m, a, b (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009109, 1\u2009\u2264\u2009a\u2009\u2264\u2009b\u2009\u2264\u2009n). They are the number of folders in Igor K.'s computer, the width of a window and the numbers of the first and the last folders that need to be deleted.","output_specification":"Print a single number: the least possible number of times Igor K. will have to select the folders using frames to select only the folders with numbers from a to b.","notes":"NoteThe images below illustrate statement tests.The first test:In this test we can select folders 3 and 4 with out first selection, folders 5, 6, 7, 8 with our second selection and folder 9 with our third, last selection.The second test:In this test we can first select all folders in the first row (2, 3, 4, 5), then \u2014 all other ones.","sample_inputs":["11 4 3 9","20 5 2 20"],"sample_outputs":["3","2"],"src_uid":"f256235c0b2815aae85a6f9435c69dac","lang_cluster":"Java","difficulty":1700,"human_solution":"import java.util.Scanner;\n\n\npublic class frames {\npublic static void main(String args[]){\n\tScanner s = new Scanner(System.in);\n\tint n = s.nextInt(),m=s.nextInt(),a=s.nextInt(),b=s.nextInt();\n\tif(a<=m&&b<=m){\n\t\tSystem.out.println(1);\n\t}\n\telse if(m==1||a==b){\n\t\tSystem.out.println(1);\n\t}\n\telse if(b-a=total)\n {\n index=0;\n total=in.read(buf);\n if(total<=0)\n return -1;\n }\n return buf[index++];\n }\n public int scanInt()throws IOException\n {\n int integer=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n integer*=10;\n integer+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n return neg*integer;\n }\n public double scanDouble()throws IOException\n {\n double doub=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n)&&n!='.')\n {\n if(n>='0'&&n<='9')\n {\n doub*=10;\n doub+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n if(n=='.')\n {\n n=scan();\n double temp=1;\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n temp\/=10;\n doub+=(n-'0')*temp;\n n=scan();\n }\n else throw new InputMismatchException();\n }\n }\n return doub*neg;\n }\n public String scanString()throws IOException\n {\n StringBuilder sb=new StringBuilder();\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n while(!isWhiteSpace(n))\n {\n sb.append((char)n);\n n=scan();\n }\n return sb.toString();\n }\n private boolean isWhiteSpace(int n)\n {\n if(n==' '||n=='\\n'||n=='\\r'||n=='\\t'||n==-1)\n return true;\n return false;\n }\n }\n \n public static void sort(int arr[],int l,int r) { \/\/sort(arr,0,n-1);\n if(l==r) {\n return;\n }\n int mid=(l+r)\/2;\n sort(arr,l,mid);\n sort(arr,mid+1,r);\n merge(arr,l,mid,mid+1,r);\n }\n public static void merge(int arr[],int l1,int r1,int l2,int r2) {\n int tmp[]=new int[r2-l1+1];\n int indx1=l1,indx2=l2;\n \/\/sorting the two halves using a tmp array\n for(int i=0;ir1) {\n tmp[i]=arr[indx2];\n indx2++;\n continue;\n }\n if(indx2>r2) {\n tmp[i]=arr[indx1];\n indx1++;\n continue;\n }\n if(arr[indx1]r1) {\n tmp[i]=arr[indx2];\n indx2++;\n continue;\n }\n if(indx2>r2) {\n tmp[i]=arr[indx1];\n indx1++;\n continue;\n }\n if(arr[indx1]query left , qr-> query right l->curr Segmrnt left r->curr segment right\n if(ql>qr) {\n return new long[]{Long.MAX_VALUE,-1};\n }\n\n if(ql==l && qr==r) {\n return new long[]{seg_tree[vertex],seg_indx[vertex]};\n }\n int mid=(l+r)\/2;\n\n \/\/Left Child\n long min1[]=min((2*vertex)+1,l,mid,ql,Math.min(qr, mid));\n\n \/\/Right Child\n long min2[]=min((2*vertex)+2,mid+1,r,Math.max(mid+1,ql),qr);\n\n if(min1[0]Position of the update value->updates value\n if(l==r) {\n seg_tree[vertex]=value;\n return;\n }\n int mid=(l+r)\/2;\n \/\/Left Child\n if(pos<=mid) {\n update((2*vertex)+1,l,mid,pos,value);\n }\n \/\/Right Child\n else {\n update((2*vertex)+2,mid+1,r,pos,value);\n }\n if(seg_tree[(2*vertex)+1] adj_lst[],weight[];\n static long len[],cost[];\n static boolean vis[];\n static long dist[][],dp[][];\n static int n,x,y;\n static seg_tree s_tree;\n public static void main(String args[]) throws IOException {\n Scan input=new Scan();\n n=input.scanInt();\n int m=input.scanInt();\n x=input.scanInt()-1;\n y=input.scanInt()-1;\n len=new long[n];\n cost=new long[n];\n adj_lst=new ArrayList[n];\n weight=new ArrayList[n];\n vis=new boolean[n];\n dist=new long[n][n];\n for(int i=0;i();\n weight[i]=new ArrayList<>();\n }\n for(int i=0;ilen[root]) {\n continue;\n }\n fin[i]=Math.min(fin[i],fin[root]+cost[root]);\n }\n Long min=Long.MAX_VALUE;\n int indx=-1;\n for(int i=0;i= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new UnknownError();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}\n\n","testcases":"[{'input': '3 2001 2\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['1 2 3']}, {'input': '7 2020 6\\r\\n1 2\\r\\n1 3\\r\\n2 4\\r\\n2 5\\r\\n3 6\\r\\n3 7\\r\\n', 'output': ['1 2 3 7 4 6 5']}, {'input': '10 3630801 0\\r\\n', 'output': ['The times have changed']}, {'input': '3 2001 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['The times have changed']}, {'input': '5 2030 13\\r\\n5 2\\r\\n2 3\\r\\n2 4\\r\\n5 3\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n2 3\\r\\n2 3\\r\\n5 2\\r\\n2 4\\r\\n3 4\\r\\n5 4\\r\\n', 'output': ['The times have changed']}, {'input': '5 2019 12\\r\\n4 1\\r\\n1 2\\r\\n4 2\\r\\n4 3\\r\\n5 3\\r\\n5 1\\r\\n3 2\\r\\n4 2\\r\\n1 2\\r\\n1 3\\r\\n5 1\\r\\n1 3\\r\\n', 'output': ['The times have changed']}, {'input': '8 2004 6\\r\\n7 4\\r\\n6 4\\r\\n7 5\\r\\n5 8\\r\\n8 4\\r\\n8 2\\r\\n', 'output': ['1 6 2 8 4 7 3 5']}, {'input': '6 2004 18\\r\\n1 3\\r\\n2 1\\r\\n6 2\\r\\n5 1\\r\\n4 6\\r\\n5 1\\r\\n2 3\\r\\n6 2\\r\\n6 1\\r\\n2 1\\r\\n4 1\\r\\n2 3\\r\\n5 1\\r\\n2 1\\r\\n4 6\\r\\n5 2\\r\\n1 3\\r\\n5 6\\r\\n', 'output': ['The times have changed']}, {'input': '7 2035 5\\r\\n5 2\\r\\n3 2\\r\\n4 2\\r\\n4 2\\r\\n3 1\\r\\n', 'output': ['2 7 1 6 3 4 5']}, {'input': '16 20922789890000 0\\r\\n', 'output': ['16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1']}, {'input': '10 2001 13\\r\\n8 3\\r\\n7 6\\r\\n5 7\\r\\n2 1\\r\\n1 4\\r\\n5 10\\r\\n7 6\\r\\n6 1\\r\\n1 8\\r\\n3 10\\r\\n5 1\\r\\n5 8\\r\\n1 3\\r\\n', 'output': ['5 1 7 8 2 4 3 6 9 10']}, {'input': '10 2670 33\\r\\n5 7\\r\\n4 10\\r\\n5 9\\r\\n5 9\\r\\n7 8\\r\\n9 10\\r\\n4 6\\r\\n4 6\\r\\n1 8\\r\\n10 3\\r\\n4 7\\r\\n9 8\\r\\n6 1\\r\\n6 5\\r\\n10 1\\r\\n9 10\\r\\n4 6\\r\\n8 2\\r\\n6 9\\r\\n6 8\\r\\n6 5\\r\\n10 3\\r\\n6 2\\r\\n3 1\\r\\n7 9\\r\\n5 2\\r\\n4 10\\r\\n6 3\\r\\n6 2\\r\\n5 3\\r\\n3 1\\r\\n6 8\\r\\n6 2\\r\\n', 'output': ['The times have changed']}, {'input': '14 2001 22\\r\\n11 5\\r\\n14 6\\r\\n2 5\\r\\n2 4\\r\\n2 3\\r\\n7 2\\r\\n1 5\\r\\n7 3\\r\\n6 8\\r\\n1 5\\r\\n6 7\\r\\n1 10\\r\\n3 5\\r\\n4 1\\r\\n14 7\\r\\n7 8\\r\\n4 8\\r\\n1 11\\r\\n12 1\\r\\n10 11\\r\\n11 3\\r\\n8 3\\r\\n', 'output': ['7 4 11 5 12 2 3 8 13 9 10 6 14 1']}, {'input': '10 2001 32\\r\\n1 3\\r\\n2 9\\r\\n5 3\\r\\n9 5\\r\\n9 3\\r\\n6 9\\r\\n6 3\\r\\n5 8\\r\\n2 7\\r\\n2 7\\r\\n8 7\\r\\n5 4\\r\\n1 6\\r\\n4 8\\r\\n8 3\\r\\n9 8\\r\\n1 5\\r\\n5 10\\r\\n2 4\\r\\n2 6\\r\\n9 10\\r\\n1 4\\r\\n1 6\\r\\n4 7\\r\\n9 10\\r\\n9 5\\r\\n9 3\\r\\n6 10\\r\\n6 9\\r\\n10 7\\r\\n1 7\\r\\n1 2\\r\\n', 'output': ['1 2 8 6 5 3 10 7 4 9']}, {'input': '15 2001 8\\r\\n9 2\\r\\n4 8\\r\\n12 13\\r\\n6 7\\r\\n12 4\\r\\n7 2\\r\\n6 13\\r\\n4 11\\r\\n', 'output': ['1 5 6 8 9 2 3 10 4 11 12 7 13 14 15']}, {'input': '14 2001 15\\r\\n12 3\\r\\n5 6\\r\\n11 3\\r\\n6 7\\r\\n3 6\\r\\n5 13\\r\\n11 2\\r\\n1 2\\r\\n14 3\\r\\n1 2\\r\\n8 4\\r\\n13 8\\r\\n3 7\\r\\n5 11\\r\\n8 9\\r\\n', 'output': ['1 4 7 10 2 11 12 9 13 14 3 5 8 6']}, {'input': '14 11414 33\\r\\n11 14\\r\\n11 8\\r\\n3 5\\r\\n14 6\\r\\n3 1\\r\\n9 13\\r\\n11 4\\r\\n11 8\\r\\n4 6\\r\\n6 2\\r\\n3 10\\r\\n10 1\\r\\n11 9\\r\\n10 5\\r\\n9 8\\r\\n6 12\\r\\n10 5\\r\\n9 10\\r\\n8 13\\r\\n9 11\\r\\n8 10\\r\\n8 9\\r\\n14 3\\r\\n7 1\\r\\n5 13\\r\\n13 8\\r\\n4 8\\r\\n1 6\\r\\n1 8\\r\\n8 2\\r\\n6 7\\r\\n10 14\\r\\n2 1\\r\\n', 'output': ['The times have changed']}, {'input': '13 3651 42\\r\\n8 4\\r\\n13 7\\r\\n8 5\\r\\n6 2\\r\\n7 13\\r\\n12 10\\r\\n7 9\\r\\n9 4\\r\\n3 4\\r\\n8 1\\r\\n12 6\\r\\n3 4\\r\\n7 1\\r\\n4 1\\r\\n7 5\\r\\n2 5\\r\\n2 7\\r\\n6 11\\r\\n9 8\\r\\n3 2\\r\\n11 12\\r\\n1 2\\r\\n7 12\\r\\n8 11\\r\\n11 13\\r\\n10 12\\r\\n11 1\\r\\n8 2\\r\\n9 7\\r\\n6 13\\r\\n8 12\\r\\n10 1\\r\\n2 12\\r\\n1 2\\r\\n8 7\\r\\n6 8\\r\\n1 8\\r\\n3 12\\r\\n13 6\\r\\n7 13\\r\\n5 4\\r\\n7 8\\r\\n', 'output': ['The times have changed']}, {'input': '11 2001 34\\r\\n2 1\\r\\n7 5\\r\\n9 8\\r\\n5 2\\r\\n9 5\\r\\n9 1\\r\\n9 11\\r\\n1 5\\r\\n7 2\\r\\n9 1\\r\\n4 7\\r\\n3 11\\r\\n9 7\\r\\n2 1\\r\\n3 7\\r\\n7 3\\r\\n7 6\\r\\n8 1\\r\\n1 9\\r\\n11 8\\r\\n8 4\\r\\n8 9\\r\\n7 11\\r\\n7 5\\r\\n9 11\\r\\n7 9\\r\\n8 11\\r\\n8 7\\r\\n4 2\\r\\n7 4\\r\\n2 4\\r\\n6 1\\r\\n4 10\\r\\n11 2\\r\\n', 'output': ['The times have changed']}, {'input': '13 2001 5\\r\\n8 6\\r\\n11 2\\r\\n13 8\\r\\n6 3\\r\\n3 12\\r\\n', 'output': ['1 3 7 8 9 6 10 5 11 12 2 13 4']}, {'input': '16 2001 68\\r\\n16 15\\r\\n16 6\\r\\n4 1\\r\\n14 15\\r\\n13 5\\r\\n1 8\\r\\n1 5\\r\\n12 10\\r\\n3 11\\r\\n8 7\\r\\n6 5\\r\\n4 3\\r\\n5 11\\r\\n6 14\\r\\n13 5\\r\\n6 4\\r\\n10 7\\r\\n10 8\\r\\n9 15\\r\\n2 4\\r\\n5 15\\r\\n5 14\\r\\n12 4\\r\\n12 8\\r\\n10 1\\r\\n12 2\\r\\n11 7\\r\\n2 9\\r\\n10 16\\r\\n16 2\\r\\n13 10\\r\\n2 15\\r\\n11 15\\r\\n16 4\\r\\n13 2\\r\\n10 6\\r\\n1 9\\r\\n16 6\\r\\n13 1\\r\\n1 9\\r\\n4 3\\r\\n8 7...', 'output': ['8 6 9 7 11 5 14 10 15 3 12 1 2 13 16 4']}, {'input': '16 919540 100\\r\\n3 8\\r\\n3 10\\r\\n10 1\\r\\n1 14\\r\\n13 3\\r\\n9 13\\r\\n14 6\\r\\n5 3\\r\\n8 4\\r\\n14 12\\r\\n16 1\\r\\n13 10\\r\\n2 10\\r\\n9 12\\r\\n5 10\\r\\n8 12\\r\\n7 14\\r\\n15 11\\r\\n2 6\\r\\n5 3\\r\\n15 16\\r\\n8 14\\r\\n5 7\\r\\n15 14\\r\\n5 14\\r\\n8 6\\r\\n8 7\\r\\n7 6\\r\\n10 1\\r\\n7 15\\r\\n9 12\\r\\n11 14\\r\\n2 7\\r\\n3 7\\r\\n3 10\\r\\n9 13\\r\\n5 2\\r\\n16 11\\r\\n10 1\\r\\n4 16\\r\\n4 2\\r\\n...', 'output': ['The times have changed']}, {'input': '16 2005 99\\r\\n13 11\\r\\n12 10\\r\\n15 11\\r\\n10 15\\r\\n7 10\\r\\n15 14\\r\\n10 14\\r\\n13 3\\r\\n7 3\\r\\n11 8\\r\\n6 14\\r\\n16 13\\r\\n7 2\\r\\n4 8\\r\\n6 11\\r\\n9 6\\r\\n9 1\\r\\n16 4\\r\\n14 3\\r\\n6 14\\r\\n2 8\\r\\n15 6\\r\\n9 13\\r\\n7 9\\r\\n15 13\\r\\n14 16\\r\\n3 5\\r\\n8 5\\r\\n9 15\\r\\n16 5\\r\\n13 2\\r\\n10 15\\r\\n16 13\\r\\n14 1\\r\\n12 9\\r\\n14 13\\r\\n7 11\\r\\n11 2\\r\\n14 4\\r\\n3 11\\r\\n...', 'output': ['The times have changed']}, {'input': '16 2046 84\\r\\n2 15\\r\\n1 10\\r\\n7 1\\r\\n1 10\\r\\n5 8\\r\\n8 10\\r\\n11 14\\r\\n8 13\\r\\n7 15\\r\\n16 15\\r\\n6 12\\r\\n12 15\\r\\n10 15\\r\\n10 9\\r\\n1 10\\r\\n5 10\\r\\n1 4\\r\\n7 13\\r\\n5 9\\r\\n3 13\\r\\n2 14\\r\\n5 15\\r\\n13 6\\r\\n7 16\\r\\n16 12\\r\\n2 12\\r\\n5 6\\r\\n8 16\\r\\n12 11\\r\\n1 2\\r\\n2 16\\r\\n5 14\\r\\n2 16\\r\\n5 2\\r\\n4 6\\r\\n2 16\\r\\n7 1\\r\\n13 11\\r\\n7 13\\r\\n1 2\\r\\n3 6\\r\\n5...', 'output': ['The times have changed']}, {'input': '16 2001 82\\r\\n12 11\\r\\n9 11\\r\\n3 5\\r\\n12 3\\r\\n9 7\\r\\n16 15\\r\\n15 4\\r\\n15 11\\r\\n14 7\\r\\n11 10\\r\\n4 1\\r\\n11 13\\r\\n15 6\\r\\n4 13\\r\\n3 11\\r\\n10 4\\r\\n10 14\\r\\n7 5\\r\\n15 4\\r\\n12 6\\r\\n16 8\\r\\n3 9\\r\\n3 11\\r\\n6 8\\r\\n13 5\\r\\n15 2\\r\\n11 5\\r\\n2 8\\r\\n16 12\\r\\n1 2\\r\\n3 8\\r\\n16 14\\r\\n16 3\\r\\n8 14\\r\\n15 11\\r\\n16 2\\r\\n3 4\\r\\n16 5\\r\\n12 8\\r\\n10 4\\r\\n6 11...', 'output': ['10 11 3 9 16 6 14 12 5 8 7 2 15 13 4 1']}, {'input': '16 2001 65\\r\\n12 9\\r\\n4 11\\r\\n10 12\\r\\n6 12\\r\\n14 2\\r\\n13 2\\r\\n8 13\\r\\n3 11\\r\\n8 6\\r\\n8 13\\r\\n1 2\\r\\n11 8\\r\\n2 16\\r\\n2 10\\r\\n15 4\\r\\n3 8\\r\\n10 16\\r\\n5 7\\r\\n8 16\\r\\n10 7\\r\\n8 2\\r\\n8 9\\r\\n1 16\\r\\n15 10\\r\\n3 12\\r\\n12 7\\r\\n15 16\\r\\n3 8\\r\\n4 1\\r\\n13 7\\r\\n11 1\\r\\n14 3\\r\\n7 9\\r\\n13 5\\r\\n11 12\\r\\n3 5\\r\\n4 7\\r\\n14 1\\r\\n3 13\\r\\n9 16\\r\\n15 14\\r\\n11...', 'output': ['8 10 3 4 12 9 14 6 15 11 5 13 7 2 1 16']}, {'input': '16 2001 99\\r\\n13 12\\r\\n3 16\\r\\n4 11\\r\\n5 7\\r\\n2 13\\r\\n7 14\\r\\n5 2\\r\\n5 3\\r\\n4 13\\r\\n9 3\\r\\n7 14\\r\\n13 15\\r\\n6 13\\r\\n14 15\\r\\n5 16\\r\\n10 16\\r\\n6 5\\r\\n2 8\\r\\n1 6\\r\\n4 11\\r\\n6 3\\r\\n7 12\\r\\n9 16\\r\\n3 10\\r\\n6 11\\r\\n5 15\\r\\n4 6\\r\\n14 16\\r\\n9 2\\r\\n13 7\\r\\n3 8\\r\\n15 3\\r\\n6 2\\r\\n10 12\\r\\n4 6\\r\\n1 5\\r\\n4 7\\r\\n7 14\\r\\n5 11\\r\\n3 12\\r\\n13 7\\r\\n14 10\\r...', 'output': ['1 6 11 2 5 3 8 14 4 12 15 16 7 9 10 13']}, {'input': '16 2001 69\\r\\n2 15\\r\\n10 6\\r\\n10 11\\r\\n3 11\\r\\n6 7\\r\\n1 15\\r\\n6 1\\r\\n1 13\\r\\n13 5\\r\\n10 15\\r\\n7 14\\r\\n4 1\\r\\n7 11\\r\\n5 3\\r\\n10 7\\r\\n9 1\\r\\n12 16\\r\\n13 11\\r\\n7 12\\r\\n12 2\\r\\n4 13\\r\\n6 7\\r\\n8 12\\r\\n10 9\\r\\n3 16\\r\\n8 15\\r\\n6 1\\r\\n6 7\\r\\n5 14\\r\\n4 10\\r\\n14 2\\r\\n5 3\\r\\n6 5\\r\\n6 5\\r\\n9 13\\r\\n9 14\\r\\n10 15\\r\\n10 6\\r\\n5 3\\r\\n10 5\\r\\n7 13\\r\\n6 11...', 'output': ['5 12 13 1 10 3 6 8 4 2 14 9 7 11 15 16']}, {'input': '16 2001 87\\r\\n13 7\\r\\n12 6\\r\\n10 7\\r\\n1 7\\r\\n15 16\\r\\n16 14\\r\\n2 3\\r\\n5 6\\r\\n10 4\\r\\n15 14\\r\\n13 1\\r\\n6 14\\r\\n2 9\\r\\n2 9\\r\\n16 8\\r\\n14 7\\r\\n4 12\\r\\n5 4\\r\\n8 14\\r\\n13 4\\r\\n2 5\\r\\n6 3\\r\\n5 14\\r\\n11 12\\r\\n10 2\\r\\n16 13\\r\\n1 3\\r\\n1 7\\r\\n15 13\\r\\n15 16\\r\\n14 3\\r\\n16 3\\r\\n8 4\\r\\n2 7\\r\\n4 3\\r\\n4 6\\r\\n1 14\\r\\n6 14\\r\\n9 14\\r\\n1 7\\r\\n1 10\\r\\n8 11\\r...', 'output': ['4 7 15 10 8 13 16 5 9 6 11 12 3 14 1 2']}, {'input': '16 1000000000000000000 0\\r\\n', 'output': ['The times have changed']}, {'input': '16 1000000000000000000 1\\r\\n16 15\\r\\n', 'output': ['The times have changed']}, {'input': '16 1000000000000000000 1\\r\\n2 1\\r\\n', 'output': ['The times have changed']}, {'input': '16 405483668029442000 2\\r\\n16 15\\r\\n15 14\\r\\n', 'output': ['The times have changed']}, {'input': '16 2001 99\\r\\n4 15\\r\\n13 15\\r\\n11 8\\r\\n10 13\\r\\n13 16\\r\\n8 15\\r\\n7 9\\r\\n10 5\\r\\n7 8\\r\\n8 13\\r\\n8 2\\r\\n2 13\\r\\n15 1\\r\\n3 12\\r\\n8 3\\r\\n8 2\\r\\n10 7\\r\\n10 14\\r\\n16 4\\r\\n3 1\\r\\n3 5\\r\\n5 9\\r\\n2 16\\r\\n15 1\\r\\n3 4\\r\\n3 14\\r\\n6 3\\r\\n10 13\\r\\n14 5\\r\\n11 7\\r\\n14 9\\r\\n4 14\\r\\n4 12\\r\\n7 16\\r\\n8 13\\r\\n11 1\\r\\n2 3\\r\\n14 12\\r\\n6 8\\r\\n6 7\\r\\n11 7\\r\\n6 12...', 'output': ['15 6 7 10 14 1 4 5 16 3 2 13 8 11 12 9']}, {'input': '16 2001 94\\r\\n12 13\\r\\n11 1\\r\\n8 3\\r\\n8 11\\r\\n11 5\\r\\n8 2\\r\\n8 9\\r\\n7 15\\r\\n6 11\\r\\n8 6\\r\\n10 13\\r\\n13 11\\r\\n7 5\\r\\n6 3\\r\\n14 2\\r\\n15 10\\r\\n3 4\\r\\n9 1\\r\\n14 10\\r\\n14 15\\r\\n11 1\\r\\n12 15\\r\\n2 10\\r\\n6 5\\r\\n2 6\\r\\n16 2\\r\\n8 7\\r\\n16 6\\r\\n7 2\\r\\n15 9\\r\\n3 15\\r\\n13 5\\r\\n11 4\\r\\n14 10\\r\\n6 11\\r\\n12 10\\r\\n13 4\\r\\n12 6\\r\\n1 4\\r\\n2 10\\r\\n6 15\\r\\n1...', 'output': ['14 5 8 15 16 7 3 2 10 11 13 6 12 1 9 4']}, {'input': '16 2001 97\\r\\n12 6\\r\\n13 8\\r\\n7 15\\r\\n11 3\\r\\n2 3\\r\\n9 15\\r\\n4 7\\r\\n10 8\\r\\n3 1\\r\\n11 10\\r\\n2 14\\r\\n4 7\\r\\n9 2\\r\\n16 8\\r\\n11 12\\r\\n6 2\\r\\n15 14\\r\\n8 7\\r\\n2 10\\r\\n9 6\\r\\n6 4\\r\\n13 11\\r\\n12 6\\r\\n1 4\\r\\n8 4\\r\\n6 1\\r\\n16 14\\r\\n12 2\\r\\n6 14\\r\\n1 14\\r\\n11 6\\r\\n11 16\\r\\n1 5\\r\\n10 16\\r\\n5 16\\r\\n11 3\\r\\n2 4\\r\\n3 14\\r\\n11 10\\r\\n13 5\\r\\n12 16\\r\\n1 ...', 'output': ['8 6 7 13 9 5 14 12 3 10 2 4 1 16 15 11']}, {'input': '16 2001 95\\r\\n6 9\\r\\n5 3\\r\\n7 16\\r\\n11 14\\r\\n2 5\\r\\n13 10\\r\\n2 1\\r\\n8 6\\r\\n7 10\\r\\n12 7\\r\\n12 13\\r\\n2 4\\r\\n3 10\\r\\n7 13\\r\\n1 8\\r\\n14 6\\r\\n1 4\\r\\n7 14\\r\\n1 15\\r\\n7 14\\r\\n11 13\\r\\n13 5\\r\\n3 14\\r\\n11 12\\r\\n11 1\\r\\n5 15\\r\\n16 14\\r\\n14 6\\r\\n16 13\\r\\n8 6\\r\\n14 10\\r\\n14 1\\r\\n16 9\\r\\n14 8\\r\\n13 3\\r\\n15 8\\r\\n7 10\\r\\n11 7\\r\\n4 10\\r\\n11 4\\r\\n11 2...', 'output': ['10 5 8 14 7 13 3 12 15 16 1 2 6 9 11 4']}, {'input': '16 2001 93\\r\\n12 13\\r\\n13 11\\r\\n10 2\\r\\n5 9\\r\\n1 15\\r\\n11 9\\r\\n8 9\\r\\n6 9\\r\\n15 11\\r\\n16 14\\r\\n14 2\\r\\n8 13\\r\\n1 2\\r\\n14 8\\r\\n14 8\\r\\n14 4\\r\\n1 15\\r\\n1 9\\r\\n16 11\\r\\n2 9\\r\\n14 10\\r\\n2 3\\r\\n10 6\\r\\n12 5\\r\\n15 6\\r\\n10 7\\r\\n12 5\\r\\n6 5\\r\\n7 1\\r\\n3 5\\r\\n7 13\\r\\n6 9\\r\\n8 3\\r\\n8 4\\r\\n3 4\\r\\n12 5\\r\\n13 6\\r\\n16 11\\r\\n8 13\\r\\n2 12\\r\\n4 12\\r\\n5 9\\r...', 'output': ['6 7 8 9 14 13 4 5 16 3 15 10 11 2 12 1']}, {'input': '16 2001 97\\r\\n12 3\\r\\n10 2\\r\\n14 9\\r\\n4 7\\r\\n9 7\\r\\n8 13\\r\\n3 15\\r\\n9 8\\r\\n13 2\\r\\n4 7\\r\\n5 14\\r\\n9 1\\r\\n5 10\\r\\n6 4\\r\\n13 12\\r\\n2 15\\r\\n7 1\\r\\n2 4\\r\\n16 12\\r\\n7 12\\r\\n5 9\\r\\n7 15\\r\\n8 3\\r\\n9 4\\r\\n14 12\\r\\n4 15\\r\\n12 15\\r\\n2 12\\r\\n13 6\\r\\n8 16\\r\\n2 11\\r\\n7 1\\r\\n9 7\\r\\n5 3\\r\\n4 15\\r\\n16 11\\r\\n13 1\\r\\n7 16\\r\\n5 11\\r\\n10 9\\r\\n4 1\\r\\n1 16\\r\\n4...', 'output': ['11 7 14 9 1 8 10 5 4 3 15 13 6 2 16 12']}, {'input': '16 2001 96\\r\\n12 16\\r\\n1 7\\r\\n5 4\\r\\n13 12\\r\\n6 12\\r\\n11 16\\r\\n16 7\\r\\n1 14\\r\\n2 11\\r\\n3 11\\r\\n6 3\\r\\n3 10\\r\\n13 3\\r\\n5 1\\r\\n4 12\\r\\n10 11\\r\\n9 5\\r\\n6 15\\r\\n3 2\\r\\n8 12\\r\\n13 8\\r\\n4 6\\r\\n5 1\\r\\n15 7\\r\\n15 12\\r\\n5 1\\r\\n1 11\\r\\n5 15\\r\\n5 15\\r\\n12 16\\r\\n10 14\\r\\n9 11\\r\\n4 2\\r\\n15 11\\r\\n6 8\\r\\n5 3\\r\\n1 4\\r\\n13 6\\r\\n12 3\\r\\n10 7\\r\\n13 15\\r\\n1...', 'output': ['4 11 10 5 2 6 15 7 1 12 13 9 3 16 8 14']}]","id":101} {"description":"In a very ancient country the following game was popular. Two people play the game. Initially first player writes a string s1, consisting of exactly nine digits and representing a number that does not exceed a. After that second player looks at s1 and writes a string s2, consisting of exactly nine digits and representing a number that does not exceed b. Here a and b are some given constants, s1 and s2 are chosen by the players. The strings are allowed to contain leading zeroes.If a number obtained by the concatenation (joining together) of strings s1 and s2 is divisible by mod, then the second player wins. Otherwise the first player wins. You are given numbers a, b, mod. Your task is to determine who wins if both players play in the optimal manner. If the first player wins, you are also required to find the lexicographically minimum winning move.","input_specification":"The first line contains three integers a, b, mod (0\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009109, 1\u2009\u2264\u2009mod\u2009\u2264\u2009107).","output_specification":"If the first player wins, print \"1\" and the lexicographically minimum string s1 he has to write to win. If the second player wins, print the single number \"2\".","notes":"NoteThe lexical comparison of strings is performed by the < operator in modern programming languages. String x is lexicographically less than string y if exists such i (1\u2009\u2264\u2009i\u2009\u2264\u20099), that xi\u2009<\u2009yi, and for any j (1\u2009\u2264\u2009j\u2009<\u2009i) xj\u2009=\u2009yj. These strings always have length 9.","sample_inputs":["1 10 7","4 0 9"],"sample_outputs":["2","1 000000001"],"src_uid":"8b6f633802293202531264446d33fee5","lang_cluster":"Java","difficulty":1800,"human_solution":"import java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Game {\n public static void main(String[] args) throws IOException {\n BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n String[] input = bf.readLine().split(\" \");\n String answer = \"\";\n long a, b, mod, ans;\n boolean oneWin = false;\n a = Integer.parseInt(input[0]);\n b = Integer.parseInt(input[1]);\n mod = Integer.parseInt(input[2]);\n long limit = Math.min(a, mod);\n long res = 0;\n\n for (ans = 1; ans <= limit; ans++) {\n res = (((ans % mod) * (1000000000 % mod)) % mod);\n if ((mod - res)% mod > b) {\n oneWin = true;\n break;\n }\n }\n\n if (oneWin) {\n String temp = String.valueOf(ans);\n int digits = temp.length();\n for (int i = 0;i < 9 - digits; i++) {\n answer += \"0\";\n }\n answer += String.valueOf(ans);\n System.out.println(\"1 \" + answer);\n } else {\n System.out.println(2);\n }\n }\n}\n","testcases":"[{'input': ['1 10 7\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 0 9\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['10 7 8\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['6 4 10\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 1 4\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 7 9\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['13 4 51\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['0 0 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 1 3\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['0 2 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 3 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 0 3\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['1 1 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 2 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 3 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 0 13\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['1 2 13\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 3 12\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['1 2 11\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 3 12\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['815 216 182\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['218 550 593\\r\\n'], 'output': ['1 000000011\\r\\n']}, {'input': ['116482865 344094604 3271060\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['19749161 751031022 646204\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['70499104 10483793 5504995\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1960930 562910 606828\\r\\n'], 'output': ['1 000000011\\r\\n']}, {'input': ['8270979 4785512 9669629\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['9323791 4748006 5840080\\r\\n'], 'output': ['1 000000005\\r\\n']}, {'input': ['972037745 4602117 5090186\\r\\n'], 'output': ['1 000000011\\r\\n']}, {'input': ['585173560 4799128 5611727\\r\\n'], 'output': ['1 000000036\\r\\n']}, {'input': ['22033548 813958 4874712\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['702034015 6007275 9777625\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['218556 828183 7799410\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['1167900 2709798 6800151\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['7004769 3114686 4659684\\r\\n'], 'output': ['1 000000002\\r\\n']}, {'input': ['1000000000 1000000000 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3631 1628 367377\\r\\n'], 'output': ['1 000000009\\r\\n']}, {'input': ['3966 5002 273075\\r\\n'], 'output': ['1 000000008\\r\\n']}, {'input': ['2388 2896 73888\\r\\n'], 'output': ['1 000000016\\r\\n']}, {'input': ['0 0 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 0 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 1000000000 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 1000000000 1\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 0 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 1000000000 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 0 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 999999999 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['999999999 0 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['999999999 999999999 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['999999999 1000000000 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 999999999 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 10000 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 1 1337\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['576694 1234562 1234567\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['12350 12000 12345\\r\\n'], 'output': ['1 000000011\\r\\n']}, {'input': ['576695 1234562 1234567\\r\\n'], 'output': ['1 000576695\\r\\n']}, {'input': ['0 0 11\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['999999999 999999999 9009009\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0 7\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['1 1 7\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 9999991 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['9902593 9902584 9902593\\r\\n'], 'output': ['1 002490619\\r\\n']}, {'input': ['10000000 9999977 9999979\\r\\n'], 'output': ['1 009909503\\r\\n']}, {'input': ['1000000000 1000000000 9999999\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['11 9 11\\r\\n'], 'output': ['1 000000010\\r\\n']}, {'input': ['0 7 13\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0 3\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['100 2 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['2 7 13\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0 9\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['1000000000 9999995 10000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 25 30\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['243 1001 1003\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['9 9 11\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 1 11\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['4 4 7\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 1 10\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1 0 11\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['0 0 11\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 0 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['10 12000 12345\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 0 2\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['0 1 3\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['3 1 7\\r\\n'], 'output': ['1 000000002\\r\\n']}, {'input': ['1000000000 2 1000000\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['23 0 23\\r\\n'], 'output': ['1 000000001\\r\\n']}, {'input': ['123456789 1234561 1234567\\r\\n'], 'output': ['1 000549636\\r\\n']}, {'input': ['11 10 13\\r\\n'], 'output': ['1 000000011\\r\\n']}, {'input': ['138 11711 11829\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1000000000 100050 1000001\\r\\n'], 'output': ['1 000000101\\r\\n']}]","id":102} {"description":"You are given a string s. Each pair of numbers l and r that fulfill the condition 1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u2009|s|, correspond to a substring of the string s, starting in the position l and ending in the position r (inclusive).Let's define the function of two strings F(x,\u2009y) like this. We'll find a list of such pairs of numbers for which the corresponding substrings of string x are equal to string y. Let's sort this list of pairs according to the pair's first number's increasing. The value of function F(x,\u2009y) equals the number of non-empty continuous sequences in the list.For example: F(babbabbababbab,\u2009babb)\u2009=\u20096. The list of pairs is as follows:(1,\u20094),\u2009(4,\u20097),\u2009(9,\u200912)Its continuous sequences are: (1,\u20094) (4,\u20097) (9,\u200912) (1,\u20094),\u2009(4,\u20097) (4,\u20097),\u2009(9,\u200912) (1,\u20094),\u2009(4,\u20097),\u2009(9,\u200912) Your task is to calculate for the given string s the sum F(s,\u2009x) for all x, that x belongs to the set of all substrings of a string s.","input_specification":"The only line contains the given string s, consisting only of small Latin letters (1\u2009\u2264\u2009|s|\u2009\u2264\u2009105).","output_specification":"Print the single number \u2014 the sought sum. Please do not use the %lld specificator to read or write 64-bit integers in \u0421++. It is preferred to use the cin, cout streams or the %I64d specificator.","notes":"NoteIn the first sample the function values at x equal to \"a\", \"aa\", \"aaa\" and \"aaaa\" equal 10, 6, 3 and 1 correspondingly.In the second sample for any satisfying x the function value is 1.","sample_inputs":["aaaa","abcdef","abacabadabacaba"],"sample_outputs":["20","21","188"],"src_uid":"db853d598b638dcdeaea5a26ae83758b","lang_cluster":"Java","difficulty":2300,"human_solution":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.util.Deque;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.ArrayDeque;\nimport java.io.InputStream;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Rustam Musin (t.me\/musin_acm)\n *\/\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n DStroka solver = new DStroka();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DStroka {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n String s = in.next();\n long answer = new DStroka.Solve(s).solve();\n out.print(answer);\n }\n\n static long sum(long n) {\n return n * (n + 1) \/ 2;\n }\n\n static class Solve {\n int n;\n char[] s;\n int[] order;\n int[] type;\n int[] lcp;\n\n Solve(String s) {\n s += \"$\";\n this.s = s.toCharArray();\n n = s.length();\n }\n\n long solve() {\n initSuffixArray();\n initLCP();\n DS ds = new DS();\n for (int i = 1; i < n; i++) ds.update(i);\n return ds.finish();\n }\n\n void updateTypes(int len) {\n int[] type2 = new int[n];\n type2[order[0]] = 0;\n for (int i = 1, j = 0; i < n; i++) {\n int left1 = type[order[i]];\n int left2 = type[order[i - 1]];\n int right1 = type[(order[i] + len) % n];\n int right2 = type[(order[i - 1] + len) % n];\n if (left1 != left2 || right1 != right2) j++;\n type2[order[i]] = j;\n }\n System.arraycopy(type2, 0, type, 0, n);\n }\n\n void countSort(int typeCount, int len) {\n int[] count = new int[typeCount];\n for (int t : type) count[t]++;\n for (int i = 0, j = 0; i < typeCount; i++) {\n int x = count[i];\n count[i] = j;\n j += x;\n }\n int[] order2 = new int[n];\n for (int x : order) order2[count[type[x]]++] = x;\n System.arraycopy(order2, 0, order, 0, n);\n updateTypes(len);\n }\n\n void initSuffixArray() {\n order = new int[n];\n type = new int[n];\n for (int i = 0; i < n; i++) order[i] = i;\n for (int i = 0; i < n; i++) type[i] = s[i];\n countSort(1 << 8, 0);\n for (int len = 1, typeCount; (typeCount = type[order[n - 1]] + 1) < n; len <<= 1) {\n for (int i = 0; i < n; i++) order[i] = (order[i] - len + n) % n;\n countSort(typeCount, len);\n }\n }\n\n void initLCP() {\n lcp = new int[n];\n for (int i = 0, k = 0; i < n - 1; i++) {\n int pi = type[i];\n int j = order[pi - 1];\n while (s[i + k] == s[j + k]) k++;\n lcp[pi] = k;\n if (k > 0) k--;\n }\n }\n\n class DS {\n Deque q;\n long total = 0;\n\n DS() {\n q = new ArrayDeque<>();\n q.add(IntIntPair.makePair(-1, 0));\n }\n\n void drop(int at) {\n while (q.peekLast().first > at) {\n IntIntPair cur = q.pollLast();\n if (q.peekLast().first == cur.first) {\n q.addLast(IntIntPair.makePair(cur.first, cur.second + q.pollLast().second));\n continue;\n }\n int left = Math.max(q.peekLast().first, at) + 1;\n int right = cur.first;\n int len = right - left + 1;\n total += len * sum(cur.second);\n q.addLast(IntIntPair.makePair(left - 1, cur.second));\n }\n }\n\n void update(int i) {\n drop(lcp[i] - 1);\n int lastIndex = n - 2 - order[i];\n q.addLast(IntIntPair.makePair(lastIndex, 1));\n }\n\n long finish() {\n drop(-1);\n return total;\n }\n\n }\n\n }\n\n }\n\n static class IntIntPair implements Comparable {\n public final int first;\n public final int second;\n\n public static IntIntPair makePair(int first, int second) {\n return new IntIntPair(first, second);\n }\n\n public IntIntPair(int first, int second) {\n this.first = first;\n this.second = second;\n }\n\n public boolean equals(Object o) {\n if (this == o) {\n return true;\n }\n if (o == null || getClass() != o.getClass()) {\n return false;\n }\n\n IntIntPair pair = (IntIntPair) o;\n\n return first == pair.first && second == pair.second;\n }\n\n public int hashCode() {\n int result = first;\n result = 31 * result + second;\n return result;\n }\n\n public String toString() {\n return \"(\" + first + \",\" + second + \")\";\n }\n\n public int compareTo(IntIntPair o) {\n int value = Integer.compare(first, o.first);\n if (value != 0) {\n return value;\n }\n return Integer.compare(second, o.second);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public String readString() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuilder res = new StringBuilder();\n do {\n if (Character.isValidCodePoint(c)) {\n res.appendCodePoint(c);\n }\n c = read();\n } while (!isSpaceChar(c));\n return res.toString();\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public String next() {\n return readString();\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void print(long i) {\n writer.print(i);\n }\n\n }\n}\n\n","testcases":"[{'input': 'aaaa\\r\\n', 'output': ['20\\r\\n']}, {'input': 'abcdef\\r\\n', 'output': ['21\\r\\n']}, {'input': 'abacabadabacaba\\r\\n', 'output': ['188\\r\\n']}, {'input': 'tkth\\r\\n', 'output': ['11\\r\\n']}, {'input': 'eqkrqe\\r\\n', 'output': ['23\\r\\n']}, {'input': 'cwuiax\\r\\n', 'output': ['21\\r\\n']}, {'input': 'hhhhqhqh\\r\\n', 'output': ['59\\r\\n']}, {'input': 'gmxfmcgp\\r\\n', 'output': ['38\\r\\n']}, {'input': 'eleellleeee\\r\\n', 'output': ['104\\r\\n']}, {'input': 'usussubuubbbbs\\r\\n', 'output': ['138\\r\\n']}, {'input': 'lhmpaugvnqzrfxke\\r\\n', 'output': ['136\\r\\n']}, {'input': 'xkkkkkkkkkkkkkkkkxkkkk\\r\\n', 'output': ['1098\\r\\n']}, {'input': 'pprppppriiriiiirprppprriir\\r\\n', 'output': ['512\\r\\n']}, {'input': 'jsoxkutcvyshsinfmtrpujedcbmyqlojzco\\r\\n', 'output': ['646\\r\\n']}, {'input': 'emcegmekgnlefkeguqkfffnduqhfhhhndlfhlfdqdncefnn\\r\\n', 'output': ['1227\\r\\n']}, {'input': 'ffffdjfddffdjdfffddjfffffffjfffjdjfffjfjfdjjfjdjjdjjjdffd\\r\\n', 'output': ['2564\\r\\n']}, {'input': 'cxvhmeyouudwuglhbwndzwmjjsgrnuwnzwaycfspyyrdckjcidfsabvdxzjkvm\\r\\n', 'output': ['2023\\r\\n']}, {'input': 'cahdktuxuukmbuqcqactqhqdcxpkqcuumckttdpmpqxxkacpappxuqkxbuahqdphhddhquthqaapm\\r\\n', 'output': ['3258\\r\\n']}, {'input': 'hhwhhwhhhwhwwhhwwwhwhhhwhwwwhhwhwhhhhhhwhwhwwwhhwwwhhwhhhhwhwwhwhwwwwhhwwhwhwwwhhhwwhwhwhhwwwhwhhhwwwhwhw\\r\\n', 'output': ['10856\\r\\n']}, {'input': 'cnrkvxbljhitbvoysdpghhhnymktvburpvxybnvugkzudmnmpuhevzyjpbtraaepszhhssmcozkgbjayztrvqwdfmjlhtvarkkdsbnjrabqexpfjozmjzfbmdsihovoxmmtjgtfyaisllysnekdxozhdwu\\r\\n', 'output': ['12399\\r\\n']}, {'input': 'qasiyhdivaiyyhdqiqsvqhtqsetxqvaeqatxesxehisyqiivhvayaxvsxhsydiesaxydysqhedxqhsqivvidqtsitiiveexiehsqdteahyxtsyqetahviyhqvytexethsqssxiytqhxxxdihxietsyxqhtitheyeateeyhythxhhqaad\\r\\n', 'output': ['17103\\r\\n']}, {'input': 'ggwgwwgwwkggwgwwkgwwwggwwwggkgkgwkwgkkgkwwgwkkggwggkwgwgkgwwkwkkkkwggwwkwkkkgwkwwwwwgwkwkkwkggwwgggkkwwkgkgkwgkgkwggkwgggwwkgkwgkwkkgwkkkkggwwwgkggkwwgkwkgwgggkggkkkwwwwwkkgkwggwgkwwwwggwwgkkggwkkwkkgkwggggggkkwkkgkkkwkwwkwggwkkwggggwg\\r\\n', 'output': ['41166\\r\\n']}, {'input': 'tmoqyzoikohtgkybnwjizgjypzycmtstmsizrqrmczmqmpewxiwlqzcaufxkchqyjegktxihlksisbgogpyxkltioovelwaqcbebgcyygxsshsirkwvtsvhpqtbomueaszkrlixueyeiccvfiuoogomjlhjkacnxtimkprmjttpmeaminvmcqagrpjighsvaosojymcjoyopsvkrphzbnckcvvckicmjwpvawjuzkofnuvcahwhzjpfngwyobiufivsjnekjcloobvzawrvosnkvalmr\\r\\n', 'output': ['42165\\r\\n']}, {'input': 'rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrbrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrbrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr\\r\\n', 'output': ['2214420\\r\\n']}, {'input': 'zzzzooozzzoozozoozzzzzzozooozoozoozzozzozoooozzzzzzoooozzozooozoozzzozozoooooozzzozozooooozozozozzooozozzooozzzzozozoozoozzzozooozzzzoozzzzozzzzoooozozozozozzoooozzzooozzoooooooozozzozozooozzzooooozozooozozzozozoozzozzzzooozzoozozozzozozoozozzzoozozoooozzooozozooooozzzzzoozoozzzozzzoozzoozozzooozzzzzzoozzozzoozzzoozozzooozoozzzozooozozzoozoozozzzzzoozoozzzooooozooooooozooooozzoozoozzzooooozoozozozozzzoozzzzzoozzzzzzooooooozzzzozzozzo\\r\\n', 'output': ['190205\\r\\n']}]","id":103} {"description":"You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecutively following vertices are located on the same straight line.Your task is to check whether polygon B is positioned strictly inside polygon A. It means that any point of polygon B should be strictly inside polygon A. \"Strictly\" means that the vertex of polygon B cannot lie on the side of the polygon A.","input_specification":"The first line contains the only integer n (3\u2009\u2264\u2009n\u2009\u2264\u2009105) \u2014 the number of vertices of polygon A. Then n lines contain pairs of integers xi,\u2009yi (|xi|,\u2009|yi|\u2009\u2264\u2009109) \u2014 coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3\u2009\u2264\u2009m\u2009\u2264\u20092\u00b7104) \u2014 the number of vertices of polygon B. Then following m lines contain pairs of integers xj,\u2009yj (|xj|,\u2009|yj|\u2009\u2264\u2009109) \u2014 the coordinates of the j-th vertex of polygon B. The vertices are given in the clockwise order. The coordinates of the polygon's vertices are separated by a single space. It is guaranteed that polygons A and B are non-degenerate, that polygon A is strictly convex, that polygon B has no self-intersections and self-touches and also for each polygon no three consecutively following vertices are located on the same straight line.","output_specification":"Print on the only line the answer to the problem \u2014 if polygon B is strictly inside polygon A, print \"YES\", otherwise print \"NO\" (without the quotes).","notes":null,"sample_inputs":["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0","5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1","5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"],"sample_outputs":["YES","NO","NO"],"src_uid":"d9eb0f6f82bd09ea53a1dbbd7242c497","lang_cluster":"Java","difficulty":2100,"human_solution":"\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Map;\nimport java.util.StringTokenizer;\nimport java.util.TreeMap;\n\n\/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n *\/\n\/**\n *\n * @author Andy Phan\n *\/\npublic class b {\n\n public static void main(String[] args) {\n FS in = new FS(System.in);\n PrintWriter out = new PrintWriter(System.out);\n\n int n = in.nextInt();\n VecL[] a = new VecL[n];\n \n for(int i = 0; i < n; i++) a[i] = new VecL(in.nextInt(), in.nextInt());\n \n TreeMap upper = new TreeMap<>();\n TreeMap lower = new TreeMap<>();\n \n for(int i = 0; i < n; i++) {\n SegL seg = new SegL(a[i], a[(i+1)%n]);\n if(a[i].x < a[(i+1)%n].x || (a[i].x == a[(i+1)%n].x && a[i].y > a[(i+1)%n].y)) upper.put(a[i].x, seg);\n else lower.put(a[i].x, seg);\n }\n \n int m = in.nextInt();\n for(int i = 0; i < m; i++) {\n VecL vec = new VecL(in.nextInt(), in.nextInt());\n Map.Entry upperE = upper.floorEntry(vec.x);\n Map.Entry lowerE = lower.ceilingEntry(vec.x);\n if(upperE == null || upperE.getValue().side(vec) != -1) {\n System.out.println(\"NO\");\n return;\n }\n if(lowerE == null || lowerE.getValue().side(vec) != -1) {\n System.out.println(\"NO\");\n return;\n }\n }\n \n System.out.println(\"YES\");\n\n out.close();\n }\n\n static class SegL {\n\n VecL from, to, dir;\n\n public SegL(VecL from, VecL to) {\n this.from = from;\n this.to = to;\n dir = to.sub(from);\n }\n\n \/\/check if the segment contains the point\n public boolean contains(VecL p) {\n VecL d = p.sub(from);\n if (d.cross(dir) != 0) {\n return false;\n }\n long dot = d.dot(dir);\n return dot >= 0 && dot <= dir.mag2();\n }\n\n \/\/(assuming I go left to right)\n \/\/returns:\n \/\/\t1 if point is above me\n \/\/\t0 if point is on me\n \/\/\t-1 if point is below me\n public long side(VecL o) {\n long cross = dir.cross(o.sub(from));\n return cross == 0 ? 0 : cross \/ Math.abs(cross);\n }\n\n \/\/returns true if this segl intersects the other, including at endpoints\n \/\/note: returns false if the two segments lie on the same line\n public boolean intersects(SegL o) {\n return side(o.from) != side(o.to) && o.side(from) != o.side(to);\n }\n\n public String toString() {\n return from + \" -> \" + to;\n }\n\n \/\/#\n static long gcd(long a, long b) {\n a = Math.abs(a);\n b = Math.abs(b);\n return b == 0 ? a : gcd(b, a % b);\n }\n \/\/$\n\n \/\/returns the lattice point of intersection or null if it is nonlattice or does not exist \n public VecL latticeIntersect(SegL o) {\n if (!intersects(o)) {\n return null;\n }\n long dirGCD = gcd(dir.x, dir.y), oDirGCD = gcd(o.dir.x, o.dir.y);\n VecL va= new VecL(dir.x \/ dirGCD, dir.y \/ dirGCD), vb = new VecL(o.dir.x \/ oDirGCD, o.dir.y \/ oDirGCD);\n if (va.x < 0 && va.y < 0) {\n va.x *= -1;\n va.y *= -1;\n }\n if (vb.x < 0 && vb.y < 0) {\n vb.x *= -1;\n vb.y *= -1;\n }\n if (va.equals(vb)) {\n return null;\n }\n long bottomScalar = va.x \/ gcd(va.x, va.y);\n long topScalar = va.y \/ gcd(va.x, va.y);\n long t2Scalar = -bottomScalar * vb.y + topScalar * vb.x;\n long t2Ans = bottomScalar * (o.from.y - from.y) - topScalar * (o.from.x - from.x);\n if (t2Ans % t2Scalar != 0) {\n return null;\n }\n long t2 = t2Ans \/ t2Scalar;\n return new VecL(t2 * vb.x + o.from.x, t2 * vb.y + o.from.y);\n }\n }\n\n static class VecL implements Comparable {\n\n long x, y;\n\n public VecL(long x, long y) {\n this.x = x;\n this.y = y;\n }\n\n public VecL add(VecL o) {\n return new VecL(x + o.x, y + o.y);\n }\n\n public VecL sub(VecL o) {\n return new VecL(x - o.x, y - o.y);\n }\n\n public VecL scale(long s) {\n return new VecL(x * s, y * s);\n }\n\n public long dot(VecL o) {\n return x * o.x + y * o.y;\n }\n\n public long cross(VecL o) {\n return x * o.y - y * o.x;\n }\n\n public long mag2() {\n return dot(this);\n }\n\n public VecL rot90() {\n return new VecL(-y, x);\n }\n\n public VecL rot270() {\n return new VecL(y, -x);\n }\n\n public String toString() {\n return \"(\" + x + \", \" + y + \")\";\n }\n\n public int hashCode() {\n return Long.hashCode(x << 13 ^ (y * 57));\n }\n\n public boolean equals(Object oo) {\n VecL o = (VecL) oo;\n return x == o.x && y == o.y;\n }\n\n public int compareTo(VecL o) {\n if (x != o.x) {\n return Long.compare(x, o.x);\n }\n return Long.compare(y, o.y);\n }\n\n \/\/origin->q1, axes-> quadrant in ccw direction\n public int quadrant() {\n if (x == 0 || y == 0) {\n if (y == 0) {\n if (x >= 0) {\n return 1;\n } else {\n return 3;\n }\n } else if (y >= 0) {\n return 2;\n } else {\n return 4;\n }\n }\n if (x > 0) {\n if (y > 0) {\n return 1;\n } else {\n return 4;\n }\n } else if (y > 0) {\n return 2;\n } else {\n return 3;\n }\n }\n\n public int radialCompare(VecL o) {\n if (quadrant() == o.quadrant()) {\n return -Long.signum(cross(o));\n }\n return Integer.compare(quadrant(), o.quadrant());\n }\n }\n\n static class FS {\n\n BufferedReader in;\n StringTokenizer token;\n\n public FS(InputStream str) {\n in = new BufferedReader(new InputStreamReader(str));\n }\n\n public String next() {\n if (token == null || !token.hasMoreElements()) {\n try {\n token = new StringTokenizer(in.readLine());\n } catch (IOException ex) {\n }\n return next();\n }\n return token.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n }\n}\n","testcases":"[{'input': '6\\r\\n-2 1\\r\\n0 3\\r\\n3 3\\r\\n4 1\\r\\n3 -2\\r\\n2 -2\\r\\n4\\r\\n0 1\\r\\n2 2\\r\\n3 1\\r\\n1 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '5\\r\\n1 2\\r\\n4 2\\r\\n3 -3\\r\\n-2 -2\\r\\n-2 1\\r\\n4\\r\\n0 1\\r\\n1 2\\r\\n4 1\\r\\n2 -1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n-1 2\\r\\n2 3\\r\\n4 1\\r\\n3 -2\\r\\n0 -3\\r\\n5\\r\\n1 0\\r\\n1 1\\r\\n3 1\\r\\n5 -1\\r\\n2 -1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7\\r\\n1 3\\r\\n4 2\\r\\n4 -1\\r\\n2 -3\\r\\n0 -3\\r\\n-3 0\\r\\n-2 2\\r\\n5\\r\\n-1 1\\r\\n2 2\\r\\n3 0\\r\\n2 -2\\r\\n0 -2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4\\r\\n3 -2\\r\\n-2 2\\r\\n2 3\\r\\n4 1\\r\\n4\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '5\\r\\n4 3\\r\\n2 -3\\r\\n-1 -3\\r\\n-1 0\\r\\n2 2\\r\\n5\\r\\n-1 -2\\r\\n-1 -1\\r\\n2 1\\r\\n3 0\\r\\n2 -2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6\\r\\n3 3\\r\\n3 -3\\r\\n0 -4\\r\\n-4 -1\\r\\n-4 2\\r\\n1 5\\r\\n9\\r\\n0 0\\r\\n2 1\\r\\n2 -3\\r\\n0 -1\\r\\n0 -3\\r\\n-2 -2\\r\\n-1 -1\\r\\n-2 1\\r\\n2 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6\\r\\n2 4\\r\\n4 2\\r\\n3 -1\\r\\n-1 -3\\r\\n-3 0\\r\\n-2 3\\r\\n12\\r\\n0 3\\r\\n0 2\\r\\n1 2\\r\\n2 3\\r\\n3 2\\r\\n1 1\\r\\n2 0\\r\\n0 -2\\r\\n0 0\\r\\n-1 -1\\r\\n-2 0\\r\\n-1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6\\r\\n-2 2\\r\\n1 3\\r\\n4 3\\r\\n5 1\\r\\n3 -2\\r\\n-1 -2\\r\\n7\\r\\n1 1\\r\\n2 4\\r\\n3 2\\r\\n6 2\\r\\n3 1\\r\\n3 0\\r\\n2 -3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6\\r\\n-3 2\\r\\n1 4\\r\\n3 3\\r\\n2 -2\\r\\n-1 -3\\r\\n-5 0\\r\\n3\\r\\n3 -2\\r\\n4 3\\r\\n5 -2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n4 -1\\r\\n-1 -2\\r\\n-2 3\\r\\n2 3\\r\\n6\\r\\n2 1\\r\\n2 2\\r\\n5 3\\r\\n5 0\\r\\n4 -2\\r\\n4 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5\\r\\n3 -1\\r\\n-1 -1\\r\\n-1 2\\r\\n3 4\\r\\n6 4\\r\\n7\\r\\n1 0\\r\\n1 2\\r\\n2 3\\r\\n2 2\\r\\n4 4\\r\\n4 2\\r\\n2 -1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3\\r\\n1 2\\r\\n5 5\\r\\n6 1\\r\\n3\\r\\n4 3\\r\\n5 2\\r\\n3 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3\\r\\n0 0\\r\\n0 1\\r\\n1 0\\r\\n3\\r\\n0 1\\r\\n1 0\\r\\n0 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n1 0\\r\\n0 1\\r\\n3 3\\r\\n3 0\\r\\n8\\r\\n-1 2\\r\\n4 6\\r\\n4 3\\r\\n5 4\\r\\n3 -2\\r\\n3 -3\\r\\n2 -2\\r\\n1 -2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n-10 -10\\r\\n-10 10\\r\\n10 10\\r\\n10 -10\\r\\n3\\r\\n-10 0\\r\\n1 5\\r\\n2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n-10 -10\\r\\n-10 10\\r\\n10 10\\r\\n10 -10\\r\\n3\\r\\n10 0\\r\\n2 2\\r\\n1 5\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n-10 -10\\r\\n-10 10\\r\\n10 10\\r\\n10 -10\\r\\n3\\r\\n0 -10\\r\\n1 5\\r\\n2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n-10 -10\\r\\n-10 10\\r\\n10 10\\r\\n10 -10\\r\\n3\\r\\n0 10\\r\\n2 2\\r\\n1 5\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n-10 -10\\r\\n-10 10\\r\\n10 10\\r\\n10 -10\\r\\n3\\r\\n-10 -10\\r\\n1 5\\r\\n2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n-10 -10\\r\\n-10 10\\r\\n10 10\\r\\n10 -10\\r\\n3\\r\\n-10 10\\r\\n1 5\\r\\n2 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n0 0\\r\\n9 4\\r\\n12 -5\\r\\n5 -5\\r\\n4\\r\\n2 0\\r\\n2 3\\r\\n5 3\\r\\n5 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3\\r\\n-1000000000 0\\r\\n1000000000 1\\r\\n1000000000 -2\\r\\n3\\r\\n-999999999 0\\r\\n999999999 0\\r\\n999999999 -1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4\\r\\n0 0\\r\\n0 4\\r\\n4 4\\r\\n4 0\\r\\n3\\r\\n2 1\\r\\n2 3\\r\\n4 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n0 10\\r\\n10 0\\r\\n0 -10\\r\\n-10 0\\r\\n3\\r\\n6 6\\r\\n6 5\\r\\n0 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n0 6\\r\\n6 0\\r\\n0 -6\\r\\n-6 0\\r\\n4\\r\\n4 4\\r\\n4 -4\\r\\n-4 -4\\r\\n-4 4\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n0 0\\r\\n0 4\\r\\n4 4\\r\\n4 0\\r\\n3\\r\\n3 1\\r\\n2 1\\r\\n4 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3\\r\\n-1000000000 1000000000\\r\\n1000000000 0\\r\\n1000 -1000000000\\r\\n3\\r\\n1000 -999999999\\r\\n1000 0\\r\\n1001 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4\\r\\n0 3\\r\\n3 0\\r\\n0 -3\\r\\n-3 0\\r\\n4\\r\\n2 2\\r\\n2 -2\\r\\n-2 -2\\r\\n-2 2\\r\\n', 'output': ['NO\\r\\n']}]","id":104} {"description":"As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x,\u2009y,\u2009z). In this coordinate system, the distance between the center of the Universe and the point is calculated by the following formula: . Mushroom scientists that work for the Great Mushroom King think that the Universe isn't exactly right and the distance from the center of the Universe to a point equals xa\u00b7yb\u00b7zc.To test the metric of mushroom scientists, the usual scientists offered them a task: find such x,\u2009y,\u2009z (0\u2009\u2264\u2009x,\u2009y,\u2009z;\u00a0x\u2009+\u2009y\u2009+\u2009z\u2009\u2264\u2009S), that the distance between the center of the Universe and the point (x,\u2009y,\u2009z) is maximum possible in the metric of mushroom scientists. The mushroom scientists aren't good at maths, so they commissioned you to do the task.Note that in this problem, it is considered that 00\u2009=\u20091.","input_specification":"The first line contains a single integer S (1\u2009\u2264\u2009S\u2009\u2264\u2009103) \u2014 the maximum sum of coordinates of the sought point. The second line contains three space-separated integers a, b, c (0\u2009\u2264\u2009a,\u2009b,\u2009c\u2009\u2264\u2009103) \u2014 the numbers that describe the metric of mushroom scientists.","output_specification":"Print three real numbers \u2014 the coordinates of the point that reaches maximum value in the metrics of mushroom scientists. If there are multiple answers, print any of them that meets the limitations. A natural logarithm of distance from the center of the Universe to the given point in the metric of mushroom scientists shouldn't differ from the natural logarithm of the maximum distance by more than 10\u2009-\u20096. We think that ln(0)\u2009=\u2009\u2009-\u2009\u221e.","notes":null,"sample_inputs":["3\n1 1 1","3\n2 0 0"],"sample_outputs":["1.0 1.0 1.0","3.0 0.0 0.0"],"src_uid":"0a9cabb857949e818453ffe411f08f95","lang_cluster":"Java","difficulty":1800,"human_solution":"import java.util.*;\nimport java.io.*;\npublic class Main {\n static class Scan {\n private byte[] buf=new byte[1024];\n private int index;\n private InputStream in;\n private int total;\n public Scan()\n {\n in=System.in;\n }\n public int scan()throws IOException\n {\n if(total<0)\n throw new InputMismatchException();\n if(index>=total)\n {\n index=0;\n total=in.read(buf);\n if(total<=0)\n return -1;\n }\n return buf[index++];\n }\n public int scanInt()throws IOException\n {\n int integer=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n integer*=10;\n integer+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n return neg*integer;\n }\n public double scanDouble()throws IOException\n {\n double doub=0;\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n int neg=1;\n if(n=='-')\n {\n neg=-1;\n n=scan();\n }\n while(!isWhiteSpace(n)&&n!='.')\n {\n if(n>='0'&&n<='9')\n {\n doub*=10;\n doub+=n-'0';\n n=scan();\n }\n else throw new InputMismatchException();\n }\n if(n=='.')\n {\n n=scan();\n double temp=1;\n while(!isWhiteSpace(n))\n {\n if(n>='0'&&n<='9')\n {\n temp\/=10;\n doub+=(n-'0')*temp;\n n=scan();\n }\n else throw new InputMismatchException();\n }\n }\n return doub*neg;\n }\n public String scanString()throws IOException\n {\n StringBuilder sb=new StringBuilder();\n int n=scan();\n while(isWhiteSpace(n))\n n=scan();\n while(!isWhiteSpace(n))\n {\n sb.append((char)n);\n n=scan();\n }\n return sb.toString();\n }\n private boolean isWhiteSpace(int n)\n {\n if(n==' '||n=='\\n'||n=='\\r'||n=='\\t'||n==-1)\n return true;\n return false;\n }\n }\n \n public static void sort(int arr[],int l,int r) { \/\/sort(arr,0,n-1);\n if(l==r) {\n return;\n }\n int mid=(l+r)\/2;\n sort(arr,l,mid);\n sort(arr,mid+1,r);\n merge(arr,l,mid,mid+1,r);\n }\n public static void merge(int arr[],int l1,int r1,int l2,int r2) {\n int tmp[]=new int[r2-l1+1];\n int indx1=l1,indx2=l2;\n \/\/sorting the two halves using a tmp array\n for(int i=0;ir1) {\n tmp[i]=arr[indx2];\n indx2++;\n continue;\n }\n if(indx2>r2) {\n tmp[i]=arr[indx1];\n indx1++;\n continue;\n }\n if(arr[indx1]r1) {\n tmp[i]=arr[indx2];\n indx2++;\n continue;\n }\n if(indx2>r2) {\n tmp[i]=arr[indx1];\n indx1++;\n continue;\n }\n if(arr[indx1] visited;\n\n\t\tstatic class Marker{\n\t\t\tString last, preLast, prepreLast, preprepreLast;\n\t\t\tInteger size, hash;\n\t\t\t\n\t\t\tpublic Marker(int size, String last, String preLast, String prepreLast, String preprepreLast){\n\t\t\t\tthis.size=size;\n\t\t\t\tthis.last=last;\n\t\t\t\tthis.preLast=preLast;\n\t\t\t\tthis.prepreLast=prepreLast;\n\t\t\t\tthis.preprepreLast=preprepreLast;\n\t\t\t}\n\n\t\t\tpublic int hashCode(){\n\t\t\t\tif(hash!=null) return hash;\n\t\t\t\thash = size;\n\t\t\t\thash = hash*31 + last.hashCode();\n\t\t\t\thash = hash*31 + preLast.hashCode();\n\t\t\t\thash = hash*31 + prepreLast.hashCode();\n\t\t\t\thash = hash*31 + preprepreLast.hashCode();\n\t\t\t\treturn hash;\n\t\t\t}\n\n\t\t\tpublic boolean equals(Object temp){\n\t\t\t\tMarker o = (Marker)temp;\n\t\t\t\treturn(\n\t\t\t\t\t\tsize.equals(o.size) &&\n\t\t\t\t\t\tlast.equals(o.last) &&\n\t\t\t\t\t\tpreLast.equals(o.preLast) &&\n\t\t\t\t\t\tprepreLast.equals(o.prepreLast)\n\t\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tpublic void solve(InputReader in, PrintWriter out){\n\t\t\tint n=in.nextInt();\n\t\t\tArrayList deck = new ArrayList();\n\n\t\t\tfor(int i=0; i();\n\t\t\tsolve(deck);\n\t\t\tif(answer){\n\t\t\t\tout.println(\"YES\");\n\t\t\t} else {\n\t\t\t\tout.println(\"NO\");\n\t\t\t}\n\t\t}\n\n\t\tboolean match(String a, String b){\n\t\t\treturn (a.charAt(0)==b.charAt(0) || a.charAt(1)==b.charAt(1));\n\t\t}\n\n\n\t\tvoid solve(ArrayList deck){\n\t\t\tint n=deck.size();\n\t\t\tif(n==1 || answer){\n\t\t\t\tanswer=true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(n>3){\n\t\t\t\tString last = deck.get(n-1);\n\t\t\t\tString _preLast = deck.get(n-2);\n\t\t\t\tString _prepreLast = deck.get(n-3);\n\t\t\t\tString _preprepreLast = deck.get(n-4);\n\t\t\t\tMarker mm = new Marker(n, last, _preLast, _prepreLast, _preprepreLast);\n\n\t\t\t\tif(visited.containsKey(mm)){\n\t\t\t\t\t\/\/System.out.println(n+\" \"+_preprepreLast+\" \"+_prepreLast+\" \"+_preLast+\" \"+last);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvisited.put(mm, true);\n\t\t\t}\n\n\t\t\tif(n>1 && match(deck.get(n-2), deck.get(n-1))){\n\t\t\t\tArrayList copy1 = new ArrayList(deck);\n\t\t\t\tcopy1.set(n-2, deck.get(n-1));\n\t\t\t\tcopy1.remove(n-1);\n\t\t\t\tsolve(copy1);\n\t\t\t}\n\t\t\t\n\t\t\tif(n>3 && match(deck.get(n-4),deck.get(n-1)) ){\n\t\t\t\tArrayList copy3 = new ArrayList(deck);\n\t\t\t\tcopy3.set(n-4, deck.get(n-1));\n\t\t\t\tcopy3.remove(n-1);\n\t\t\t\tsolve(copy3);\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class InputReader{\n\t\tprivate BufferedReader reader;\n\t\tprivate StringTokenizer tokenizer;\n\t\t\n\t\tpublic InputReader(){\n\t\t\tif(FILE_IO){\n\t\t\t\ttry{\n\t\t\t\t\treader = new BufferedReader(new FileReader(input_file));\n\t\t\t\t} catch(FileNotFoundException e){\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t\t\t}\n\t\t\ttokenizer = null;\n\t\t}\n\n\t\tpublic String next(){\n\t\t\twhile(tokenizer==null || !tokenizer.hasMoreTokens()){\n\t\t\t\ttry{\n\t\t\t\t\ttokenizer = new StringTokenizer(reader.readLine());\n\t\t\t\t} catch (IOException e){\n\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn tokenizer.nextToken();\n\t\t}\n\n\t\tpublic int nextInt(){\n\t\t\treturn (int)Integer.parseInt(next());\n\t\t}\n\n\t\tpublic long nextLong(){\n\t\t\treturn (long)Long.parseLong(next());\n\t\t}\n\n\t\tpublic double nextDouble(){\n\t\t\treturn (double)Double.parseDouble(next());\n\t\t}\n\n\t\tpublic String nextLine(){\n\t\t\tString s = null;\n\t\t\ttry{\n\t\t\t\ts = reader.readLine();\n\t\t\t} catch(Exception e){\n\t\t\t\tthrow new RuntimeException(e);\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\t}\n}","testcases":"[{'input': '4\\r\\n2S 2S 2C 2C\\r\\n', 'output': ['YES']}, {'input': '2\\r\\n3S 2C\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n2S 2S 4S 3S 2S\\r\\n', 'output': ['YES']}, {'input': '5\\r\\n5S 5S 7S 4S 3H\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n7S 7S 4S 8H 4H\\r\\n', 'output': ['NO']}, {'input': '5\\r\\n4S 2H 3S 3S 2H\\r\\n', 'output': ['NO']}, {'input': '52\\r\\n3H 6S 3S 2S 2S 3S 4S 3H 2C 4S 3C 3S 2S 2C 2S 6S 4C 3S 5C 3S 2S 4S 3S 5S 2H 2S 4H 3S 3S 4H 4S 2C 2H 2S 4S 6D 4C 4H 2H 4S 3H 6D 6S 3C 3C 4H 5S 3S 3S 2H 2S 4C\\r\\n', 'output': ['NO']}, {'input': '52\\r\\n2S 4S 3S 2S 4S 3S 4S 4S 8S 3S 2S 2S 5S 3S 3S 2S 3S 5S 4S 4S 2S 2S 4S 4S 6S 2S 5S 2S 5S 2S 2S 2S 4S 2S 5S 5S 2S 6S 8S 6S 2S 2S TS 2H 4S 4S 3S 3S 2S 2S 7S 3S\\r\\n', 'output': ['YES']}, {'input': '5\\r\\nAD 5S KH AH AS\\r\\n', 'output': ['YES']}, {'input': '50\\r\\nTS 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D\\r\\n', 'output': ['NO']}, {'input': '5\\r\\nAD 5S KH AH KS\\r\\n', 'output': ['YES']}, {'input': '5\\r\\nAD 5S KH AH JS\\r\\n', 'output': ['NO']}, {'input': '20\\r\\nJD 5H 3H 9H 2S 5S 5H QS 8D 7H TS 9S 4H 5S 9H 4H 3S KS KS JS\\r\\n', 'output': ['NO']}, {'input': '21\\r\\nJS 5S 9S KH 9D JH 3S KH QH 5D TC 3S 5S 4H 4H 5S 7S AH 4S 3S 6S\\r\\n', 'output': ['NO']}, {'input': '51\\r\\nJD 8D QD TC JD AD JD 5D 5S QC TC 4H 8S 7D QD QD 3H TH 8D 9D 5D 4D 6D 7D 9C 2D AD 6D 6H AD 5D 3D AC AC JC 5D 3D KC 7C AD 4D 8C QD QH 6D 9C 2D 6D 3C KC TD\\r\\n', 'output': ['NO']}, {'input': '52\\r\\nKD KD 8H 9C 7C 8D JD 3D 9C KD 6D 9C QD TC 7D TD 3C KD 6D 2D TC 6D AC QD 2C 3D 8D KH AD QD 2C 6C JH 6D 8D 2C 7D QD 7C 7H TD 4D 2D 8D TC 5D 8D KD 7C QC TD 5D\\r\\n', 'output': ['NO']}, {'input': '52\\r\\nJS 7S 3S 2S 7S TS 4S 6S 5H TS 4S TH 6H 9S TH TH 4S 4H 2H TH TC TH TS TS 4S TS 2S TH TH TS 6S TS TS 3S TS TH 5H TS TS 5S 7H 2H TS 6S 6H 2H TS TH 2S 4S 4H 4S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\n8D AD AC 9H AS AD KH AD QH AH AC AS 8H KS TD AH KS AD AD AS KD AD AS AH AS AD AD AH AC AD KC JD 8D AC 9D AC AD QD KC AD JS JC AD TD KC JD TD 8D KS KC KD KD\\r\\n', 'output': ['YES']}, {'input': '52\\r\\nAD JD JD TD AD 8D QD AH TC QH AD TD 2D AD QD 4D 3C 3D 3H 6D 8C 3C 3S 6C QC KD 2D 4S TD 5D 3S 3S 3H 3S KH 3H 3D 3H JH JH QH 9H TH 3H KH 7H 3H TH AH 3S 4H 3H\\r\\n', 'output': ['YES']}, {'input': '10\\r\\n4C 8C 8D JC 8C 5S 8H 8C 8S 8H\\r\\n', 'output': ['YES']}, {'input': '10\\r\\nQH QS QS JH QS 6S 7H QH QH QS\\r\\n', 'output': ['YES']}, {'input': '10\\r\\nKS 4S KS KH TS TS KC KH KH KS\\r\\n', 'output': ['YES']}, {'input': '11\\r\\nJD 5D JC JH 6C 6D JH 6S 6S JS JD\\r\\n', 'output': ['YES']}, {'input': '11\\r\\nJS KH JC JS 9S 9H 6H 7H JH AS AH\\r\\n', 'output': ['YES']}, {'input': '11\\r\\n3S 2H TS 9D 9S 2S 2S 9S 3C 2S 2C\\r\\n', 'output': ['YES']}, {'input': '12\\r\\n9S TS QS KD KS AS QS KS 6S AD AD AS\\r\\n', 'output': ['YES']}, {'input': '12\\r\\nJC 8C AC TH AH AC TC AS AH TC AS AS\\r\\n', 'output': ['YES']}, {'input': '12\\r\\n6S 6S 3S 4C 2S 2S 7S 2C 2S 4S 2S 2S\\r\\n', 'output': ['YES']}, {'input': '51\\r\\n7S 4C 2S JS 5C 2H 2C 3C 4C QC 2C 2C 2S 4S 2H 2H 4C 2C 6C 2C 2C JC 8C QC JC 8C TC 7H 4C 8S QH 4H 8C 3H 4S 3H 7H 8S 4C 4S 4S 4S 2H 4H QH 3H 3H 3H 4H 8C 3C\\r\\n', 'output': ['YES']}, {'input': '51\\r\\n2S 2H 2C 2C 3H 2H 7S 2D 6H 2H 2C 2H 2H 5S 2S 3C 2C 2H 2S 2C 5C JC 2S 4C 3C 2C 5C 4C 4D 8C 5C 6C 7C 4C 4C 6S TS 3C TH 4C 4C TS 7C TC 3C TS TC 2S TH TC 2C\\r\\n', 'output': ['YES']}, {'input': '52\\r\\nAC 4C TC 9C TH AD 3C TC 4S 5C TD QD TH 4C 4D 3H TC 4S TH 8H 7H 4D TH QD 4D 8H QH 4D 4H 8D 4H 4D 8H 3D 9D 8H 9D 9C 9H 8D TD 3H 5H 6D QD 9H 6D KD 9H 6D 2D 9D\\r\\n', 'output': ['YES']}, {'input': '52\\r\\nJH 8H 9D TH 5H 9H 5H JH 5H 8H 9D QH 9H 6C AD AC 9C AD AH 9C AC 5C 5C AC 5H 5C 8C 5D KD 5H 5C 8D 5D 8D KD 5D QD 8S 8C 8C 8H 8C JD 8C 8D 8C 8H 9C JD 8D 8D JD\\r\\n', 'output': ['NO']}, {'input': '52\\r\\n9D AD 9C 6C 9D 7D 6D TS 6D 6D 3D QH 9D 9D 9H 9D 9D 2H 5D JH 9H 5C JC TC 9D 9C 2C 9C 9D 4H 4D AC 9D 4C AC 8C 9C QC 8C 9D 7D QC 9H 9D 2C 9D 9C 3C 7H 9C TC 9H\\r\\n', 'output': ['NO']}, {'input': '52\\r\\n9D 5D TC 4D 7D 3D JD 5C 7D TD 5D TD 6H TD TD AD 6D AD TD 2C TD TS TD TD 2H 7D TD QD 2D 2H AC 9D 2D 2C QC AD 2D 4C JC 2D AD 5D 5C AC AD 6C 8D 4D 7C 8C JC AC\\r\\n', 'output': ['NO']}, {'input': '51\\r\\nAH 6S 2S 6H 6S 4S 3S 9S 5S 4S 2S 9S 2S 3S 2S JS 2S 2S 9H 2S 9S 2S 3S 9S 4S 4S 9S 9S 2S 2S 3S 2S 6H 7S 3S 3H 6S 3S 2H 6S 3S 6H 7H 6S 6S 4S 4H 5H 4H 4H 6H\\r\\n', 'output': ['YES']}, {'input': '51\\r\\nJC 6S 2S 6H 6S 4S 3S 9S 5S 4S 2S 9S 2S 3S 2S JS 2S 2S 9H 2S 9S 2S 3S 9S 4S 4S 9S 9S 2S 2S 3S 2S 6H 7S 3S 3H 6S 3S 2H 6S 3S 6H 7H 6S 6S 4S 4H 5H 4H 4H 6H\\r\\n', 'output': ['YES']}, {'input': '51\\r\\n9C 6S 2S 6H 6S 4S 3S 9S 5S 4S 2S 9S 2S 3S 2S JS 2S 2S 9H 2S 9S 2S 3S 9S 4S 4S 9S 9S 2S 2S 3S 2S 6H 7S 3S 3H 6S 3S 2H 6S 3S 6H 7H 6S 6S 4S 4H 5H 4H 4H 6H\\r\\n', 'output': ['YES']}, {'input': '51\\r\\n7C 6S 2S 6H 6S 4S 3S 9S 5S 4S 2S 9S 2S 3S 2S JS 2S 2S 9H 2S 9S 2S 3S 9S 4S 4S 9S 9S 2S 2S 3S 2S 6H 7S 3S 3H 6S 3S 2H 6S 3S 6H 7H 6S 6S 4S 4H 5H 4H 4H 6H\\r\\n', 'output': ['YES']}, {'input': '52\\r\\n2D 5S 5S JS 5H 5C 5S 5H 2S 5S 9S 3S 2S 5S 2S 2S 5S 4S 3S 5S 7H 3S 5S 7S 4S 2S TS 2S 3S 3S 3S 3S 3S 3S 2S 7S 3S 2S 2S 2S 2S 2S 5S 2H 2C 4S 2S 2S 4S 7S 2S 2S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\n3D 5S 5S JS 5H 5C 5S 5H 2S 5S 9S 3S 2S 5S 2S 2S 5S 4S 3S 5S 7H 3S 5S 7S 4S 2S TS 2S 3S 3S 3S 3S 3S 3S 2S 7S 3S 2S 2S 2S 2S 2S 5S 2H 2C 4S 2S 2S 4S 7S 2S 2S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\nTD 5S 5S JS 5H 5C 5S 5H 2S 5S 9S 3S 2S 5S 2S 2S 5S 4S 3S 5S 7H 3S 5S 7S 4S 2S TS 2S 3S 3S 3S 3S 3S 3S 2S 7S 3S 2S 2S 2S 2S 2S 5S 2H 2C 4S 2S 2S 4S 7S 2S 2S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\nJD 5S 5S JS 5H 5C 5S 5H 2S 5S 9S 3S 2S 5S 2S 2S 5S 4S 3S 5S 7H 3S 5S 7S 4S 2S TS 2S 3S 3S 3S 3S 3S 3S 2S 7S 3S 2S 2S 2S 2S 2S 5S 2H 2C 4S 2S 2S 4S 7S 2S 2S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\nAH 5S 5S JS 5H 5C 5S 5H 2S 5S 9S 3S 2S 5S 2S 2S 5S 4S 3S 5S 7H 3S 5S 7S 4S 2S TS 2S 3S 3S 3S 3S 3S 3S 2S 7S 3S 2S 2S 2S 2S 2S 5S 2H 2C 4S 2S 2S 4S 7S 2S 2S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\n7H 5S 5S JS 5H 5C 5S 5H 2S 5S 9S 3S 2S 5S 2S 2S 5S 4S 3S 5S 7H 3S 5S 7S 4S 2S TS 2S 3S 3S 3S 3S 3S 3S 2S 7S 3S 2S 2S 2S 2S 2S 5S 2H 2C 4S 2S 2S 4S 7S 2S 2S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\n2D 5S 4S 4S 4C 2S 4H 4S 4H 4C 3S 4S 4S 4H 5S 4H 4H 5S 2S 4S 4S 2S 4S 4C 4S 4S 9S 4H 4S 3S 3H 4S 4S 7S 3S 3S 2H 3S 7S 4S 2S 7S 2S 2S 3S 3C 2S 3S 3S 2S 5S 3S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\nAC 5S 4S 4S 4C 2S 4H 4S 4H 4C 3S 4S 4S 4H 5S 4H 4H 5S 2S 4S 4S 2S 4S 4C 4S 4S 9S 4H 4S 3S 3H 4S 4S 7S 3S 3S 2H 3S 7S 4S 2S 7S 2S 2S 3S 3C 2S 3S 3S 2S 5S 3S\\r\\n', 'output': ['YES']}, {'input': '52\\r\\n7D 5S 4S 4S 4C 2S 4H 4S 4H 4C 3S 4S 4S 4H 5S 4H 4H 5S 2S 4S 4S 2S 4S 4C 4S 4S 9S 4H 4S 3S 3H 4S 4S 7S 3S 3S 2H 3S 7S 4S 2S 7S 2S 2S 3S 3C 2S 3S 3S 2S 5S 3S\\r\\n', 'output': ['YES']}, {'input': '1\\r\\n3C\\r\\n', 'output': ['YES']}, {'input': '4\\r\\n2C 3D 4D 5C\\r\\n', 'output': ['NO']}]","id":106} {"description":"Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones. We know that the game can be fully completed, that is, its parts do not form cyclic dependencies. Rubik has 3 computers, on which he can play this game. All computers are located in different houses. Besides, it has turned out that each part of the game can be completed only on one of these computers. Let's number the computers with integers from 1 to 3. Rubik can perform the following actions: Complete some part of the game on some computer. Rubik spends exactly 1 hour on completing any part on any computer. Move from the 1-st computer to the 2-nd one. Rubik spends exactly 1 hour on that. Move from the 1-st computer to the 3-rd one. Rubik spends exactly 2 hours on that. Move from the 2-nd computer to the 1-st one. Rubik spends exactly 2 hours on that. Move from the 2-nd computer to the 3-rd one. Rubik spends exactly 1 hour on that. Move from the 3-rd computer to the 1-st one. Rubik spends exactly 1 hour on that. Move from the 3-rd computer to the 2-nd one. Rubik spends exactly 2 hours on that. Help Rubik to find the minimum number of hours he will need to complete all parts of the game. Initially Rubik can be located at the computer he considers necessary. ","input_specification":"The first line contains integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009200) \u2014 the number of game parts. The next line contains n integers, the i-th integer \u2014 ci (1\u2009\u2264\u2009ci\u2009\u2264\u20093) represents the number of the computer, on which you can complete the game part number i. Next n lines contain descriptions of game parts. The i-th line first contains integer ki (0\u2009\u2264\u2009ki\u2009\u2264\u2009n\u2009-\u20091), then ki distinct integers ai,\u2009j (1\u2009\u2264\u2009ai,\u2009j\u2009\u2264\u2009n;\u00a0ai,\u2009j\u2009\u2260\u2009i) \u2014 the numbers of parts to complete before part i. Numbers on all lines are separated by single spaces. You can assume that the parts of the game are numbered from 1 to n in some way. It is guaranteed that there are no cyclic dependencies between the parts of the game.","output_specification":"On a single line print the answer to the problem.","notes":"NoteNote to the second sample: before the beginning of the game the best strategy is to stand by the third computer. First we complete part 5. Then we go to the 1-st computer and complete parts 3 and 4. Then we go to the 2-nd computer and complete parts 1 and 2. In total we get 1+1+2+1+2, which equals 7 hours.","sample_inputs":["1\n1\n0","5\n2 2 1 1 3\n1 5\n2 5 1\n2 5 4\n1 5\n0"],"sample_outputs":["1","7"],"src_uid":"be42e213ff43e303e475d77a9560367f","lang_cluster":"Java","difficulty":1700,"human_solution":"import java.util.List;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\nimport java.io.InputStream;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author AlexFetisov\n *\/\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskA solver = new TaskA();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskA {\n\n private int n;\n private int[] completeOn;\n private int[] degIn;\n private boolean[][] g;\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n n = in.nextInt();\n completeOn = Utils.readIntArray(in, n);\n degIn = new int[n];\n g = new boolean[n][n];\n for (int i = 0; i < n; ++i) {\n int am = in.nextInt();\n for (int j = 0; j < am; ++j) {\n int x = in.nextInt()-1;\n g[x][i] = true;\n degIn[i]++;\n }\n }\n int res = Integer.MAX_VALUE;\n for (int i = 1; i <= 3; ++i) {\n res = Math.min(res, process(i));\n }\n out.println(res);\n }\n\n private int process(int cur) {\n boolean[] visited = new boolean[n];\n int cost = 0;\n int[] curDegIn = degIn.clone();\n while (true) {\n boolean finished = true;\n List queue = new ArrayList();\n for (int i = 0; i < n; ++i) {\n if (!visited[i]) {\n finished = false;\n if (curDegIn[i] == 0 && completeOn[i] == cur) {\n queue.add(i);\n }\n }\n }\n if (finished) break;\n if (queue.size() == 0) {\n cur++;\n ++cost;\n if (cur == 4) {\n cur = 1;\n }\n continue;\n }\n for (int x : queue) {\n ++cost;\n visited[x] = true;\n for (int i = 0; i < n; ++i) {\n if (g[x][i]) {\n --curDegIn[i];\n }\n }\n }\n }\n return cost;\n }\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer stt;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String nextLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n public String nextString() {\n while (stt == null || !stt.hasMoreTokens()) {\n stt = new StringTokenizer(nextLine());\n }\n return stt.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n}\n\nclass Utils {\n public static int[] readIntArray(InputReader in, int n) {\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) {\n a[i] = in.nextInt();\n }\n return a;\n }\n\n}\n\n","testcases":"[{'input': '1\\r\\n1\\r\\n0\\r\\n', 'output': ['1']}, {'input': '5\\r\\n2 2 1 1 3\\r\\n1 5\\r\\n2 5 1\\r\\n2 5 4\\r\\n1 5\\r\\n0\\r\\n', 'output': ['7']}, {'input': '7\\r\\n1 3 3 1 2 1 1\\r\\n0\\r\\n1 1\\r\\n1 1\\r\\n2 1 6\\r\\n3 1 2 7\\r\\n1 1\\r\\n1 1\\r\\n', 'output': ['11']}, {'input': '2\\r\\n2 1\\r\\n0\\r\\n1 1\\r\\n', 'output': ['4']}, {'input': '3\\r\\n2 1 2\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['4']}, {'input': '4\\r\\n2 1 1 1\\r\\n0\\r\\n0\\r\\n1 1\\r\\n1 3\\r\\n', 'output': ['6']}, {'input': '6\\r\\n1 1 2 3 3 1\\r\\n2 2 3\\r\\n0\\r\\n0\\r\\n0\\r\\n2 2 1\\r\\n1 1\\r\\n', 'output': ['10']}, {'input': '8\\r\\n2 2 2 1 1 2 1 1\\r\\n3 5 6 7\\r\\n1 5\\r\\n2 5 6\\r\\n1 5\\r\\n0\\r\\n1 5\\r\\n1 5\\r\\n2 5 6\\r\\n', 'output': ['11']}, {'input': '9\\r\\n3 3 2 1 3 1 2 2 1\\r\\n2 4 3\\r\\n0\\r\\n2 4 2\\r\\n0\\r\\n1 4\\r\\n2 4 2\\r\\n0\\r\\n1 4\\r\\n3 4 3 8\\r\\n', 'output': ['13']}, {'input': '10\\r\\n3 1 2 2 2 1 2 1 1 1\\r\\n0\\r\\n2 6 9\\r\\n0\\r\\n1 9\\r\\n0\\r\\n1 3\\r\\n4 3 6 5 2\\r\\n3 6 4 2\\r\\n0\\r\\n1 3\\r\\n', 'output': ['14']}, {'input': '11\\r\\n1 2 2 3 3 2 2 2 2 3 1\\r\\n1 4\\r\\n2 7 11\\r\\n0\\r\\n0\\r\\n1 2\\r\\n1 11\\r\\n0\\r\\n1 2\\r\\n3 7 11 2\\r\\n3 3 2 9\\r\\n0\\r\\n', 'output': ['14']}, {'input': '12\\r\\n1 3 2 2 1 3 2 1 3 2 2 2\\r\\n2 3 4\\r\\n3 12 11 10\\r\\n1 8\\r\\n2 8 7\\r\\n2 9 10\\r\\n1 3\\r\\n0\\r\\n0\\r\\n1 4\\r\\n4 3 1 12 9\\r\\n3 8 3 4\\r\\n1 4\\r\\n', 'output': ['18']}, {'input': '13\\r\\n3 3 2 2 1 3 1 1 1 1 2 1 2\\r\\n5 6 3 11 13 12\\r\\n1 6\\r\\n2 10 6\\r\\n3 6 3 11\\r\\n1 6\\r\\n1 10\\r\\n3 6 2 3\\r\\n4 6 3 9 11\\r\\n3 6 2 3\\r\\n0\\r\\n3 6 2 3\\r\\n4 6 3 4 13\\r\\n2 6 3\\r\\n', 'output': ['21']}, {'input': '14\\r\\n3 2 2 1 2 1 1 3 1 2 2 3 1 1\\r\\n2 9 13\\r\\n3 9 13 8\\r\\n2 9 6\\r\\n3 9 6 13\\r\\n1 9\\r\\n1 9\\r\\n3 9 6 13\\r\\n2 9 13\\r\\n0\\r\\n4 9 3 13 4\\r\\n4 9 6 13 2\\r\\n2 9 13\\r\\n1 9\\r\\n8 9 5 6 3 13 7 4 11\\r\\n', 'output': ['20']}, {'input': '15\\r\\n1 2 3 2 3 2 2 2 3 3 3 2 3 1 3\\r\\n5 2 7 4 3 6\\r\\n0\\r\\n2 7 4\\r\\n2 2 15\\r\\n1 7\\r\\n1 7\\r\\n0\\r\\n2 4 6\\r\\n1 6\\r\\n2 15 3\\r\\n4 12 2 15 7\\r\\n0\\r\\n3 2 5 6\\r\\n3 2 4 6\\r\\n1 2\\r\\n', 'output': ['20']}, {'input': '16\\r\\n3 3 1 3 2 3 2 2 3 1 2 3 2 2 2 3\\r\\n1 14\\r\\n4 14 10 13 6\\r\\n3 14 15 6\\r\\n1 14\\r\\n4 14 10 9 7\\r\\n4 14 10 13 9\\r\\n4 14 10 13 6\\r\\n4 14 4 12 3\\r\\n2 14 4\\r\\n1 14\\r\\n1 14\\r\\n2 14 1\\r\\n4 14 10 4 1\\r\\n0\\r\\n2 14 10\\r\\n1 14\\r\\n', 'output': ['22']}, {'input': '17\\r\\n3 2 3 2 2 2 1 3 3 3 3 2 3 3 3 1 1\\r\\n0\\r\\n0\\r\\n2 8 10\\r\\n4 12 8 6 16\\r\\n0\\r\\n2 8 13\\r\\n3 2 8 10\\r\\n1 12\\r\\n4 8 17 3 16\\r\\n2 2 8\\r\\n0\\r\\n1 2\\r\\n2 8 10\\r\\n2 12 8\\r\\n2 8 10\\r\\n1 8\\r\\n2 12 8\\r\\n', 'output': ['21']}, {'input': '18\\r\\n2 1 1 3 2 1 3 2 3 3 2 2 1 1 3 1 1 3\\r\\n3 16 8 6\\r\\n3 16 6 1\\r\\n4 6 13 5 7\\r\\n2 6 2\\r\\n4 16 6 17 1\\r\\n2 16 8\\r\\n3 6 17 12\\r\\n1 16\\r\\n0\\r\\n3 6 15 1\\r\\n3 16 6 12\\r\\n7 16 9 8 6 13 17 14\\r\\n1 6\\r\\n1 6\\r\\n3 8 6 13\\r\\n0\\r\\n1 6\\r\\n3 9 6 13\\r\\n', 'output': ['26']}, {'input': '19\\r\\n2 1 2 3 3 3 2 1 1 1 1 3 3 1 1 1 2 2 3\\r\\n0\\r\\n2 1 7\\r\\n0\\r\\n4 3 2 17 13\\r\\n1 17\\r\\n1 3\\r\\n3 1 3 6\\r\\n4 1 17 9 13\\r\\n3 1 16 17\\r\\n0\\r\\n3 3 6 17\\r\\n1 6\\r\\n6 10 6 7 17 9 11\\r\\n3 10 17 13\\r\\n4 3 17 13 8\\r\\n1 3\\r\\n3 6 7 16\\r\\n0\\r\\n6 1 7 17 11 13 15\\r\\n', 'output': ['29']}, {'input': '20\\r\\n1 2 2 2 1 3 3 2 2 1 2 2 3 1 2 2 2 1 1 1\\r\\n2 10 8\\r\\n5 10 12 3 20 7\\r\\n0\\r\\n3 10 15 3\\r\\n0\\r\\n3 14 17 3\\r\\n2 12 20\\r\\n0\\r\\n3 17 10 12\\r\\n1 17\\r\\n1 5\\r\\n1 5\\r\\n0\\r\\n1 18\\r\\n3 18 5 12\\r\\n5 5 12 8 3 19\\r\\n0\\r\\n0\\r\\n1 12\\r\\n1 18\\r\\n', 'output': ['24']}, {'input': '11\\r\\n3 1 3 2 3 2 3 2 3 1 3\\r\\n6 2 3 9 5 7 10\\r\\n1 6\\r\\n2 6 2\\r\\n5 6 2 3 9 5\\r\\n2 3 9\\r\\n0\\r\\n5 3 9 5 8 4\\r\\n4 2 3 9 5\\r\\n2 2 3\\r\\n8 6 2 3 9 5 4 11 7\\r\\n4 2 3 9 5\\r\\n', 'output': ['21']}, {'input': '12\\r\\n2 3 3 1 1 3 2 2 3 1 3 3\\r\\n1 9\\r\\n1 1\\r\\n2 2 11\\r\\n5 1 2 11 5 8\\r\\n4 9 10 1 11\\r\\n5 9 10 12 11 5\\r\\n4 1 12 11 5\\r\\n5 10 1 2 12 11\\r\\n0\\r\\n1 9\\r\\n1 12\\r\\n0\\r\\n', 'output': ['19']}, {'input': '13\\r\\n3 2 2 1 3 3 2 3 2 2 1 2 3\\r\\n7 4 3 2 5 9 8 13\\r\\n1 4\\r\\n1 4\\r\\n0\\r\\n3 4 2 6\\r\\n2 4 2\\r\\n4 4 3 2 9\\r\\n5 4 2 6 9 7\\r\\n3 4 2 6\\r\\n6 4 3 2 5 9 7\\r\\n6 4 3 2 6 9 7\\r\\n8 4 2 6 5 9 8 11 10\\r\\n7 4 3 2 6 9 8 11\\r\\n', 'output': ['21']}, {'input': '14\\r\\n2 3 1 3 1 1 1 2 2 3 1 1 3 1\\r\\n4 14 9 8 5\\r\\n4 4 8 5 1\\r\\n9 4 14 9 8 1 2 13 7 12\\r\\n0\\r\\n2 14 8\\r\\n2 4 14\\r\\n7 9 6 10 8 1 2 13\\r\\n2 4 6\\r\\n1 14\\r\\n1 9\\r\\n8 4 6 10 8 5 1 2 3\\r\\n7 14 6 10 8 1 2 7\\r\\n5 10 8 5 1 2\\r\\n0\\r\\n', 'output': ['21']}, {'input': '15\\r\\n3 2 2 2 1 1 2 1 1 2 2 3 3 3 2\\r\\n1 13\\r\\n4 13 1 8 14\\r\\n10 5 13 1 8 14 4 2 11 15 10\\r\\n6 5 13 1 8 9 14\\r\\n0\\r\\n11 5 13 1 8 14 4 2 11 10 3 12\\r\\n11 13 1 8 14 4 2 11 15 10 3 6\\r\\n2 13 1\\r\\n4 5 13 1 8\\r\\n8 5 13 1 8 14 2 11 15\\r\\n6 5 13 1 8 14 2\\r\\n10 5 13 1 8 14 2 11 15 10 3\\r\\n0\\r\\n4 13 1 8 9\\r\\n8 5 13 1 8 9 14 2 11\\r\\n', 'output': ['23']}, {'input': '16\\r\\n3 1 2 3 3 2 3 1 3 2 2 1 2 2 1 2\\r\\n0\\r\\n0\\r\\n7 2 8 4 12 5 9 11\\r\\n1 1\\r\\n4 1 8 4 12\\r\\n5 2 4 12 5 11\\r\\n4 4 12 5 10\\r\\n0\\r\\n5 1 8 4 12 5\\r\\n6 1 4 12 5 9 11\\r\\n6 2 1 8 4 12 5\\r\\n2 4 13\\r\\n3 1 8 4\\r\\n8 1 4 13 12 5 10 3 6\\r\\n4 4 12 5 6\\r\\n8 8 4 13 12 5 9 6 14\\r\\n', 'output': ['26']}, {'input': '17\\r\\n2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2\\r\\n5 4 14 2 11 7\\r\\n3 13 4 14\\r\\n7 6 4 14 2 1 10 12\\r\\n2 6 13\\r\\n9 4 2 9 8 7 17 1 10 12\\r\\n0\\r\\n5 4 14 2 9 11\\r\\n4 13 4 2 11\\r\\n4 13 4 14 2\\r\\n7 13 4 2 11 8 7 1\\r\\n4 13 4 14 2\\r\\n8 6 4 2 8 7 17 1 10\\r\\n0\\r\\n1 4\\r\\n7 13 4 14 2 9 8 7\\r\\n6 4 2 17 1 10 12\\r\\n5 13 4 2 9 8\\r\\n', 'output': ['27']}, {'input': '18\\r\\n1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3\\r\\n5 9 3 14 12 2\\r\\n7 9 4 3 14 16 7 12\\r\\n1 9\\r\\n1 9\\r\\n6 9 14 12 1 6 15\\r\\n6 9 14 12 2 1 11\\r\\n2 9 14\\r\\n7 9 14 7 12 2 1 6\\r\\n0\\r\\n6 9 18 14 7 1 6\\r\\n4 9 14 7 1\\r\\n2 9 14\\r\\n6 9 3 14 7 1 6\\r\\n2 9 3\\r\\n9 9 3 14 16 12 2 1 6 17\\r\\n4 9 4 18 14\\r\\n8 9 18 14 12 1 11 6 13\\r\\n2 9 4\\r\\n', 'output': ['26']}, {'input': '19\\r\\n2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3\\r\\n0\\r\\n3 1 10 6\\r\\n8 1 6 2 17 18 12 15 7\\r\\n5 6 2 9 17 18\\r\\n6 6 2 17 18 12 16\\r\\n1 11\\r\\n9 1 11 6 2 17 18 4 12 15\\r\\n3 1 6 2\\r\\n4 1 6 2 8\\r\\n0\\r\\n1 1\\r\\n5 1 6 2 17 18\\r\\n12 1 10 6 2 8 17 18 4 12 15 7 3\\r\\n10 11 6 2 17 18 4 12 16 15 7\\r\\n8 1 6 2 8 17 18 12 16\\r\\n8 11 6 2 9 17 18 4 12\\r\\n3 11 6 2\\r\\n5 10 6 2 9 17\\r\\n10 1 6 2 17 18 12 5 15 7 3\\r\\n', 'output': ['30']}, {'input': '20\\r\\n2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1\\r\\n1 7\\r\\n13 7 1 11 4 6 16 20 12 5 18 19 15 10\\r\\n8 7 1 11 4 6 17 8 16\\r\\n3 7 1 11\\r\\n9 7 1 11 4 6 8 20 12 3\\r\\n4 7 1 11 4\\r\\n0\\r\\n6 7 1 11 4 6 17\\r\\n4 7 1 11 4\\r\\n7 7 1 11 4 6 17 5\\r\\n2 7 1\\r\\n9 7 1 11 4 6 17 8 14 20\\r\\n11 7 1 11 4 6 20 3 5 15 10 2\\r\\n5 7 1 11 4 6\\r\\n9 7 1 11 4 6 8 16 14 5\\r\\n5 7 1 11 4 6\\r\\n5 7 1 11 4 6\\r\\n11 7 1 11 4 9 6 17 8 20 3 5\\r\\n11 7 1 11 4 6 17 16 20 12 5 18\\r\\n6 7 1 11 4 6 14\\r\\n', 'output': ['35']}, {'input': '21\\r\\n1 2 1 3 3 3 1 1 2 2 3 1 3 1 3 3 1 1 1 2 2\\r\\n1 5\\r\\n0\\r\\n1 11\\r\\n0\\r\\n0\\r\\n0\\r\\n1 8\\r\\n0\\r\\n1 11\\r\\n1 1\\r\\n1 19\\r\\n0\\r\\n1 2\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 19\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['25']}, {'input': '22\\r\\n2 3 2 3 3 2 1 2 3 3 1 3 1 1 2 2 3 3 1 3 2 2\\r\\n0\\r\\n1 8\\r\\n1 22\\r\\n1 12\\r\\n0\\r\\n1 14\\r\\n0\\r\\n0\\r\\n0\\r\\n2 22 14\\r\\n1 12\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 16\\r\\n1 13\\r\\n0\\r\\n', 'output': ['25']}, {'input': '23\\r\\n3 1 3 3 2 2 2 1 3 2 3 1 1 1 1 2 3 1 2 1 3 1 1\\r\\n0\\r\\n1 11\\r\\n1 11\\r\\n2 11 16\\r\\n1 2\\r\\n3 11 1 12\\r\\n2 11 16\\r\\n2 12 2\\r\\n1 13\\r\\n2 12 2\\r\\n0\\r\\n0\\r\\n0\\r\\n2 13 11\\r\\n0\\r\\n1 11\\r\\n2 12 2\\r\\n3 16 6 21\\r\\n1 11\\r\\n0\\r\\n0\\r\\n2 11 12\\r\\n0\\r\\n', 'output': ['27']}, {'input': '24\\r\\n1 2 1 1 2 2 1 1 3 2 3 1 3 2 3 3 1 1 3 2 3 2 1 2\\r\\n1 16\\r\\n0\\r\\n0\\r\\n1 2\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 2\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n2 12 24\\r\\n0\\r\\n0\\r\\n1 11\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n', 'output': ['27']}, {'input': '25\\r\\n3 3 1 1 1 2 2 2 3 1 2 3 2 1 2 2 2 3 2 1 2 3 2 1 1\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 12\\r\\n0\\r\\n1 19\\r\\n0\\r\\n2 12 21\\r\\n2 3 10\\r\\n0\\r\\n1 21\\r\\n0\\r\\n1 9\\r\\n1 3\\r\\n0\\r\\n0\\r\\n2 3 2\\r\\n0\\r\\n1 12\\r\\n0\\r\\n1 3\\r\\n2 21 9\\r\\n', 'output': ['29']}, {'input': '26\\r\\n1 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\\r\\n1 9\\r\\n1 1\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 5\\r\\n0\\r\\n2 15 12\\r\\n1 8\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n2 3 26\\r\\n0\\r\\n0\\r\\n0\\r\\n1 22\\r\\n0\\r\\n1 8\\r\\n', 'output': ['30']}, {'input': '27\\r\\n2 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\\r\\n0\\r\\n0\\r\\n0\\r\\n1 12\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 26\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 27\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 5\\r\\n0\\r\\n2 20 27\\r\\n1 18\\r\\n0\\r\\n', 'output': ['30']}, {'input': '28\\r\\n2 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\\r\\n0\\r\\n1 7\\r\\n0\\r\\n2 28 18\\r\\n1 28\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n2 10 18\\r\\n3 8 10 18\\r\\n0\\r\\n2 1 20\\r\\n0\\r\\n1 18\\r\\n1 27\\r\\n2 27 18\\r\\n0\\r\\n0\\r\\n1 28\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 28\\r\\n1 9\\r\\n', 'output': ['33']}, {'input': '29\\r\\n3 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\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 1\\r\\n0\\r\\n0\\r\\n2 28 15\\r\\n0\\r\\n0\\r\\n0\\r\\n2 24 23\\r\\n1 28\\r\\n0\\r\\n1 28\\r\\n1 20\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n1 28\\r\\n0\\r\\n0\\r\\n2 23 16\\r\\n0\\r\\n0\\r\\n1 7\\r\\n1 28\\r\\n', 'output': ['32']}, {'input': '30\\r\\n1 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\\r\\n0\\r\\n1 20\\r\\n0\\r\\n1 7\\r\\n2 6 9\\r\\n1 20\\r\\n1 20\\r\\n3 7 6 9\\r\\n2 10 6\\r\\n0\\r\\n0\\r\\n2 6 9\\r\\n0\\r\\n0\\r\\n1 20\\r\\n2 6 9\\r\\n2 6 9\\r\\n0\\r\\n2 6 9\\r\\n0\\r\\n2 6 9\\r\\n3 27 6 9\\r\\n2 6 9\\r\\n2 6 9\\r\\n0\\r\\n0\\r\\n0\\r\\n2 6 9\\r\\n3 6 9 19\\r\\n3 27 6 9\\r\\n', 'output': ['34']}, {'input': '200\\r\\n3 3 3 1 3 1 3 1 1 1 3 2 1 1 3 1 3 3 2 2 2 2 3 3 1 3 2 3 1 2 3 3 2 2 1 2 3 3 1 3 1 3 3 3 1 2 1 3 3 1 2 1 2 3 2 2 3 2 2 3 2 3 1 1 1 2 2 2 1 3 1 2 1 3 2 3 2 1 2 2 1 1 2 2 1 3 3 2 2 1 3 2 3 2 3 1 2 2 2 3 3 2 2 3 2 3 3 3 3 3 2 2 3 3 2 3 2 1 2 3 2 3 2 1 2 3 3 1 2 3 2 2 3 3 3 1 2 3 3 2 3 3 3 3 3 1 2 1 3 3 1 1 2 1 2 3 1 3 2 3 1 1 2 3 3 2 2 1 3 3 1 3 1 2 1 2 3 1 1 3 2 1 1 1 2 1 1 2 2 2 3 1 2 1 1 1 1 2 1 2\\r\\n19 52 113 18 109 125 8 150 180 173 174 116 130 79 122 112 19 80 110 121\\r\\n2 52 124\\r\\n13 52 129 148 125 150 ...', 'output': ['224']}, {'input': '200\\r\\n1 2 3 2 1 1 3 3 3 3 2 1 1 2 3 3 1 3 2 3 1 3 3 1 2 3 3 2 2 1 3 3 3 3 1 1 2 2 2 2 2 1 1 2 3 2 3 3 3 2 2 1 2 3 2 1 1 1 1 1 3 2 2 2 2 1 3 1 2 2 3 1 1 2 1 1 1 1 2 2 2 1 3 2 1 1 2 2 2 1 1 3 1 3 3 1 3 3 2 3 2 2 3 1 3 3 1 3 3 3 3 2 1 3 1 3 2 2 1 3 2 2 3 1 2 1 2 3 1 3 1 2 1 2 2 3 2 3 2 2 3 2 2 2 3 1 3 3 1 1 2 3 1 2 3 2 2 2 1 3 2 1 1 3 2 1 3 2 1 1 3 2 3 3 2 1 2 3 2 1 3 2 2 3 1 3 3 3 2 1 3 2 3 2 3 3 2 1 1 1\\r\\n16 96 58 20 140 86 51 130 57 66 64 112 177 54 123 62 155\\r\\n0\\r\\n0\\r\\n9 3 125 15 94 46 124 51 130 121\\r\\n4 56 124...', 'output': ['220']}, {'input': '200\\r\\n1 3 2 3 2 3 3 3 2 2 3 2 3 1 1 3 3 2 2 2 1 1 3 3 3 1 1 1 1 2 2 3 1 3 2 3 3 2 1 2 3 2 2 1 2 1 3 3 3 1 3 3 3 2 2 1 3 3 1 1 2 1 2 2 3 3 3 2 1 2 2 2 2 3 2 1 3 1 3 2 2 2 1 3 2 2 3 3 1 3 3 1 3 1 1 2 3 1 1 2 3 1 3 2 1 1 2 2 2 1 1 3 3 1 1 3 1 1 2 1 3 2 1 2 2 3 2 2 3 3 3 1 2 3 3 1 2 3 2 3 2 1 1 2 2 1 3 1 3 3 3 3 3 2 3 3 1 1 1 1 3 1 2 3 1 2 3 3 3 1 3 2 3 3 3 3 3 3 3 1 2 1 3 1 3 1 1 1 1 3 3 2 2 3 1 3 2 3 2 2\\r\\n0\\r\\n0\\r\\n3 193 176 85\\r\\n0\\r\\n1 193\\r\\n3 83 167 85\\r\\n0\\r\\n1 193\\r\\n5 161 193 85 16 44\\r\\n5 83 38 158 85 141\\r\\n7 120 4 158 ...', 'output': ['219']}, {'input': '200\\r\\n1 3 3 1 1 2 1 3 2 2 3 2 2 1 3 1 1 3 3 2 3 3 2 3 2 3 1 2 3 3 2 2 3 3 1 3 3 1 1 1 2 1 1 1 2 2 2 3 2 3 2 1 1 3 2 3 2 1 1 3 3 1 3 1 3 3 3 3 1 2 3 2 1 1 1 2 1 3 2 3 2 1 3 3 2 2 3 3 1 2 1 3 1 2 2 1 1 3 3 3 3 2 1 1 2 1 3 1 3 3 1 2 1 2 1 2 2 1 3 1 2 3 2 3 2 1 1 1 3 3 1 3 2 2 1 1 3 1 3 2 1 3 3 1 1 3 2 2 3 1 2 3 3 1 1 2 1 2 3 1 2 2 3 1 1 1 1 2 2 3 1 1 3 2 3 3 3 3 2 2 3 3 2 3 2 3 1 2 3 1 1 2 3 2 1 1 3 2 3 1\\r\\n3 4 164 15\\r\\n8 15 35 25 18 32 168 10 118\\r\\n3 50 15 35\\r\\n0\\r\\n0\\r\\n2 4 15\\r\\n0\\r\\n5 50 15 44 84 120\\r\\n5 15 111 91 66 1...', 'output': ['222']}, {'input': '200\\r\\n3 1 2 3 2 1 3 2 2 1 3 1 1 1 3 1 3 3 1 1 3 1 2 2 2 1 3 3 2 1 3 2 3 3 3 2 2 1 3 1 2 1 3 2 2 2 2 1 1 2 2 3 1 2 1 3 2 3 2 1 2 1 2 3 3 2 2 2 2 1 2 2 1 2 3 1 1 1 3 3 1 3 2 3 1 2 2 1 2 2 3 3 1 1 1 2 1 1 3 1 3 2 2 1 3 1 2 3 1 3 2 3 3 3 1 3 1 2 3 3 2 2 2 2 2 3 2 3 3 3 3 2 3 2 3 2 1 3 2 1 3 2 1 1 3 1 3 1 2 2 2 2 1 1 1 1 3 2 1 3 3 1 1 2 1 3 3 1 1 3 1 3 2 2 2 3 2 3 2 3 1 2 3 2 3 3 2 3 3 1 1 2 2 2 3 1 2 2 2 2\\r\\n0\\r\\n0\\r\\n11 153 175 47 143 18 78 79 113 170 35 49\\r\\n8 45 153 67 74 161 162 122 170\\r\\n4 153 137 67 72\\r\\n2 153 10...', 'output': ['223']}, {'input': '200\\r\\n3 2 2 1 3 2 2 3 1 1 2 3 3 1 2 2 3 3 1 1 3 3 3 1 1 3 2 3 2 3 3 2 2 1 3 2 1 2 3 1 1 3 3 2 3 1 1 2 3 2 1 3 2 2 3 3 1 1 1 3 2 1 3 1 2 1 2 1 2 3 1 3 2 2 1 1 1 1 3 2 1 1 1 1 3 1 3 1 3 3 1 2 2 2 1 2 3 1 2 3 1 1 2 3 3 3 1 3 2 2 2 2 2 2 3 1 1 3 1 3 1 1 3 3 1 2 1 3 3 2 1 2 2 1 1 2 3 1 3 3 3 2 2 1 1 1 3 3 1 2 3 1 1 3 2 3 2 1 3 3 2 1 3 1 1 1 2 1 1 2 3 2 3 2 3 1 3 1 3 1 3 3 1 2 2 3 3 3 2 1 3 1 1 2 2 2 3 3 1 1\\r\\n0\\r\\n3 96 43 53\\r\\n3 43 156 199\\r\\n1 43\\r\\n3 1 43 33\\r\\n6 43 50 191 21 57 168\\r\\n10 43 194 185 192 83 101 152 80 191 ...', 'output': ['222']}, {'input': '200\\r\\n1 2 3 3 1 2 1 1 2 1 1 1 1 2 3 3 3 1 2 2 2 2 3 2 1 2 2 3 3 1 1 3 1 1 1 3 1 3 3 2 2 3 3 3 2 3 1 1 1 1 2 3 2 3 3 3 1 1 3 3 1 2 3 1 3 1 3 2 3 2 1 3 1 1 1 2 1 3 2 2 2 3 2 2 2 2 1 3 3 3 3 1 3 1 2 1 2 1 2 1 2 3 2 3 1 3 1 2 1 1 2 3 3 1 2 1 1 1 1 2 3 1 1 1 2 3 2 1 1 2 3 3 2 3 3 3 1 3 1 2 3 2 3 2 1 2 3 2 2 2 3 1 2 3 2 1 2 3 1 1 1 3 1 2 3 2 3 1 3 2 1 2 3 1 1 1 1 2 2 2 1 2 1 2 3 3 2 1 3 3 2 2 3 1 1 2 1 3 1 2\\r\\n11 164 21 199 71 131 112 110 4 146 192 179\\r\\n4 71 127 60 14\\r\\n14 193 144 133 70 97 71 53 110 145 113 57 166...', 'output': ['219']}, {'input': '200\\r\\n3 1 3 3 2 1 2 1 1 3 3 3 2 3 2 3 3 2 1 1 2 3 2 2 1 1 2 2 2 3 3 2 2 3 2 1 2 3 1 1 3 1 1 2 2 2 3 3 2 2 3 2 3 1 2 2 2 1 3 1 3 3 3 2 3 2 2 1 2 1 1 3 2 2 3 3 2 3 2 1 2 3 3 3 3 1 2 1 1 3 1 3 1 2 2 1 3 1 1 2 2 3 1 3 1 2 3 3 2 1 2 1 2 1 2 3 2 1 1 2 1 3 1 3 1 3 2 1 2 1 3 3 1 1 1 2 1 2 3 3 1 2 2 1 1 3 1 1 1 3 2 3 1 2 2 3 1 2 1 1 1 1 1 3 3 3 1 1 2 2 3 3 2 2 2 1 3 1 1 3 2 1 1 3 3 3 2 2 1 1 1 1 2 3 3 3 2 2 1 3\\r\\n7 132 13 75 196 148 170 110\\r\\n10 132 16 77 192 46 146 55 75 99 98\\r\\n1 132\\r\\n1 132\\r\\n5 132 103 73 119 13\\r\\n6 13...', 'output': ['221']}, {'input': '200\\r\\n2 1 1 3 2 1 3 2 1 2 2 2 3 1 3 1 3 3 2 2 2 3 1 2 1 2 1 2 1 3 1 3 2 2 2 2 2 2 3 2 3 2 3 2 2 3 2 3 2 3 2 3 3 1 1 3 2 3 3 1 3 2 1 1 1 3 1 2 2 2 2 1 2 3 2 1 1 3 1 1 3 2 1 3 2 2 1 2 1 2 1 3 2 2 2 1 2 1 2 3 3 3 1 1 2 2 3 3 3 3 1 3 1 2 1 3 1 2 2 2 2 1 2 1 2 1 2 1 2 1 1 3 1 2 3 1 2 1 3 1 3 1 2 1 3 3 1 2 1 1 3 3 3 3 3 2 3 2 2 2 2 1 3 3 3 3 3 2 1 1 3 3 3 3 2 1 2 2 2 2 2 1 2 1 2 1 2 1 3 3 2 2 3 1 1 2 2 3 2 2\\r\\n6 84 74 147 109 151 78\\r\\n13 157 14 38 43 55 12 96 111 138 30 76 146 108\\r\\n7 7 12 60 139 159 199 2\\r\\n6 7 14 5...', 'output': ['216']}, {'input': '200\\r\\n1 2 1 3 2 1 1 3 3 3 1 3 1 2 1 1 3 2 2 3 2 3 1 2 2 3 2 3 2 3 2 1 3 1 3 3 3 3 2 3 2 2 3 3 2 3 2 2 1 3 2 2 2 1 2 1 2 3 3 1 3 1 2 1 1 2 2 1 1 2 3 3 2 2 1 3 1 2 2 2 1 2 2 3 3 2 1 1 1 1 2 1 3 1 3 2 1 3 3 2 1 2 3 1 3 2 2 2 3 3 2 1 3 3 2 2 3 1 3 1 2 2 3 1 3 2 1 3 3 2 2 2 1 1 3 1 2 3 2 1 2 3 2 2 3 2 1 3 2 2 3 2 3 2 3 2 2 2 2 2 1 3 1 3 3 3 1 3 1 3 1 2 2 3 2 3 1 3 1 3 3 3 1 1 2 2 1 1 2 1 1 3 1 1 2 3 2 2 2 2\\r\\n11 120 34 23 75 191 50 115 196 15 134 160\\r\\n8 105 34 167 25 191 50 43 15\\r\\n1 55\\r\\n1 42\\r\\n8 159 31 122 25 191 ...', 'output': ['219']}, {'input': '200\\r\\n3 3 2 3 2 3 1 3 2 2 1 3 2 2 1 3 1 3 3 3 2 2 2 2 1 1 3 1 1 2 1 3 1 3 2 1 1 2 3 3 2 3 1 1 3 2 2 2 3 2 1 3 3 2 3 2 2 2 3 3 2 3 2 3 1 2 2 3 3 2 3 3 1 3 1 3 1 1 1 3 1 1 2 3 2 1 1 1 2 2 2 2 3 2 1 2 3 1 3 3 1 2 2 1 2 1 1 3 3 3 1 1 2 3 1 2 3 2 2 1 2 2 3 1 3 3 1 1 2 2 1 1 2 2 3 3 2 3 2 2 3 3 2 3 3 1 2 1 3 1 2 1 1 3 2 3 2 2 2 2 2 3 1 1 2 1 1 3 2 2 1 3 3 1 2 3 2 1 2 3 3 1 1 1 2 2 1 2 1 2 2 2 3 1 3 3 3 2 3 3\\r\\n5 188 126 156 182 91\\r\\n3 102 139 93\\r\\n4 139 56 152 126\\r\\n0\\r\\n5 35 127 37 93 174\\r\\n4 55 21 154 91\\r\\n4 10 93 126 ...', 'output': ['213']}, {'input': '200\\r\\n3 2 2 2 2 3 1 1 1 2 2 2 3 2 3 3 3 1 3 2 3 1 2 2 1 1 1 3 1 3 1 1 1 1 2 3 3 1 3 1 2 2 1 2 3 2 1 2 2 1 1 2 1 2 3 1 3 1 1 2 1 3 2 3 1 2 2 3 1 3 2 2 2 1 1 2 1 1 2 2 1 2 2 2 2 2 3 1 3 2 2 1 3 2 2 2 3 1 3 1 3 1 1 1 2 1 1 3 3 1 3 2 3 3 1 3 3 2 1 1 3 1 1 2 3 3 3 2 1 3 3 1 2 3 3 2 2 3 2 3 1 1 3 1 3 2 2 2 2 3 1 1 2 1 1 2 1 2 3 2 3 3 1 2 3 2 2 2 2 3 1 2 3 3 2 3 3 2 3 1 3 3 2 1 1 1 2 2 2 3 3 1 2 2 1 2 3 2 2 1\\r\\n1 125\\r\\n0\\r\\n2 125 34\\r\\n1 116\\r\\n3 76 100 59\\r\\n0\\r\\n5 176 175 126 80 142\\r\\n3 19 172 116\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n4 125 116 200 ...', 'output': ['210']}, {'input': '200\\r\\n2 1 2 3 2 2 1 2 2 2 1 3 2 2 2 2 1 1 3 2 2 2 3 3 3 1 2 3 2 1 2 2 1 3 3 2 1 3 3 1 1 2 2 2 3 1 2 3 1 1 3 3 1 1 1 1 2 2 1 2 2 2 3 2 2 1 2 3 3 2 2 3 3 3 2 1 1 2 1 1 1 2 3 3 2 3 1 2 3 1 3 1 1 1 3 1 1 1 1 3 2 3 3 2 2 1 1 2 2 1 1 1 2 3 1 3 3 2 2 1 1 3 1 1 2 2 2 1 3 3 3 2 2 2 2 3 1 3 2 3 1 3 3 2 2 1 1 2 1 1 3 2 1 1 2 3 2 2 2 3 1 2 3 2 1 1 2 2 2 3 1 3 2 1 1 1 3 2 1 1 1 1 2 2 2 3 1 2 3 3 2 1 1 1 3 3 2 2 2 1\\r\\n4 15 85 52 111\\r\\n0\\r\\n0\\r\\n2 190 140\\r\\n4 74 52 124 64\\r\\n4 29 181 52 167\\r\\n2 52 184\\r\\n1 31\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n2 21 184\\r\\n0...', 'output': ['210']}, {'input': '200\\r\\n3 1 1 1 3 3 3 1 3 3 1 3 1 2 3 3 3 2 1 2 2 3 3 1 1 3 2 1 3 2 1 2 3 2 2 1 1 2 2 1 1 3 2 2 1 2 2 1 2 2 1 3 1 2 3 1 3 3 1 3 1 3 2 3 2 2 1 2 3 2 1 3 2 3 1 1 1 1 1 1 2 2 3 2 3 3 3 1 3 1 2 3 1 1 3 2 3 2 1 1 3 2 2 2 3 2 1 3 2 1 3 2 3 2 2 1 2 1 2 1 3 2 1 2 1 3 2 2 1 3 3 3 2 2 2 1 2 3 1 1 1 2 1 2 1 2 3 1 1 3 3 2 2 1 1 3 3 1 1 1 1 2 3 1 3 3 3 2 1 3 3 1 3 3 1 2 1 2 1 1 2 3 2 2 1 1 1 1 3 3 3 3 3 3 3 1 3 3 3 2\\r\\n5 200 120 25 2 163\\r\\n5 200 120 21 25 90\\r\\n6 200 120 25 189 2 76\\r\\n3 200 120 25\\r\\n5 200 120 115 25 28\\r\\n4 200 1...', 'output': ['212']}, {'input': '200\\r\\n1 1 3 3 2 2 2 2 2 3 2 3 1 1 1 2 2 2 3 3 1 1 2 1 3 1 3 2 2 2 3 1 3 2 3 2 2 3 1 1 3 3 2 3 3 3 2 2 1 2 3 3 2 2 1 3 2 1 2 3 1 3 2 1 1 1 2 1 3 1 1 3 2 3 1 2 3 3 2 1 2 1 2 3 3 3 1 1 3 3 2 3 3 1 2 2 3 1 3 3 2 1 3 3 2 2 3 2 2 3 1 2 2 3 2 3 2 3 1 3 1 1 3 2 2 2 3 2 2 3 2 3 1 2 3 1 1 2 3 2 1 2 2 3 1 1 3 1 1 1 1 2 2 1 1 3 1 2 3 3 1 2 3 1 2 2 3 2 2 1 1 2 2 1 2 1 3 1 1 1 2 3 2 2 2 2 3 2 2 2 3 1 3 3 1 1 1 3 2 2\\r\\n3 159 22 96\\r\\n2 100 148\\r\\n3 180 22 123\\r\\n3 44 80 22\\r\\n4 102 111 180 22\\r\\n1 39\\r\\n9 112 180 186 185 42 159 22 36 ...', 'output': ['208']}, {'input': '200\\r\\n2 2 2 3 2 1 1 2 3 1 3 2 1 1 1 2 2 2 3 1 3 3 2 1 1 2 1 3 1 3 3 1 1 3 2 1 3 2 2 3 1 2 3 2 2 2 3 3 1 1 3 3 1 2 3 2 3 2 1 1 2 3 3 2 3 3 2 1 3 2 2 3 1 2 2 2 2 2 3 2 3 3 2 3 3 3 3 1 2 2 2 1 3 2 1 1 2 1 3 1 1 3 3 1 1 2 1 2 2 3 1 1 2 1 1 1 2 3 2 2 1 1 1 1 3 2 1 1 2 3 2 2 3 2 2 2 1 3 3 3 3 2 1 1 1 3 2 3 1 3 2 2 2 1 3 2 1 2 1 2 1 2 1 1 1 1 3 1 2 2 1 2 3 2 3 3 2 3 1 3 3 3 2 2 2 1 2 1 1 1 2 2 3 1 2 2 3 3 2 2\\r\\n2 105 58\\r\\n5 3 105 174 47 138\\r\\n0\\r\\n1 3\\r\\n0\\r\\n1 105\\r\\n3 3 105 8\\r\\n2 162 105\\r\\n3 105 174 44\\r\\n4 3 98 105 174\\r\\n1 56\\r...', 'output': ['213']}, {'input': '200\\r\\n3 3 1 3 2 3 2 3 1 3 3 1 1 2 3 1 2 2 2 3 2 2 2 2 1 3 3 2 2 2 3 3 3 3 1 1 3 1 3 1 2 1 2 3 2 2 3 3 3 3 1 3 1 3 1 3 3 3 2 2 1 1 2 1 2 2 2 2 1 2 1 1 2 3 2 3 2 2 2 3 3 3 3 3 2 2 1 1 1 2 1 1 2 3 2 3 1 3 1 1 1 3 3 2 3 2 1 3 1 3 1 2 2 2 2 1 1 2 2 3 2 1 2 2 3 3 1 1 3 3 3 3 1 1 1 3 1 3 2 1 1 3 2 1 1 2 3 3 3 3 2 2 1 2 3 2 2 2 1 3 2 1 2 1 3 2 3 3 1 3 3 3 2 1 3 3 2 2 1 2 2 1 1 3 2 1 3 3 2 1 1 2 3 1 2 2 2 2 3 1\\r\\n0\\r\\n3 7 146 123\\r\\n1 71\\r\\n4 62 140 24 93\\r\\n0\\r\\n7 41 186 144 104 10 32 189\\r\\n1 71\\r\\n1 71\\r\\n0\\r\\n6 71 62 24 72 123 104...', 'output': ['215']}, {'input': '200\\r\\n1 2 3 1 1 1 2 2 2 2 1 2 1 2 3 2 2 3 2 1 2 1 1 2 2 1 2 2 3 1 2 3 3 3 1 1 1 2 1 1 1 1 1 1 1 2 3 2 1 1 3 2 1 2 1 1 3 3 1 3 2 3 2 1 3 3 3 3 1 1 3 3 3 1 2 1 1 1 1 1 1 1 1 2 1 3 3 1 2 1 2 1 2 2 1 2 1 2 3 3 2 2 2 1 1 2 2 3 3 1 1 1 2 2 3 1 3 2 1 3 1 2 1 1 2 1 2 3 1 1 1 2 2 2 3 3 2 3 3 3 3 1 1 2 3 3 3 1 1 1 1 1 3 2 1 3 2 2 2 3 3 2 3 2 2 1 2 2 3 1 2 2 1 1 1 3 3 1 3 1 1 2 1 3 1 2 3 1 1 2 2 2 3 1 2 2 2 1 2 3\\r\\n2 49 38\\r\\n3 200 49 38\\r\\n5 159 38 94 182 192\\r\\n4 49 38 94 148\\r\\n2 200 159\\r\\n7 9 38 111 89 94 92 125\\r\\n8 38 68 17...', 'output': ['213']}, {'input': '200\\r\\n2 3 1 2 1 3 2 1 1 2 1 2 3 3 1 2 1 3 3 2 1 1 3 1 2 3 3 3 1 1 3 1 1 1 2 3 3 3 1 2 3 2 2 1 2 3 3 1 1 2 1 3 3 1 2 3 3 2 2 1 2 1 2 1 3 2 2 3 2 2 1 1 3 3 2 2 1 1 3 1 1 1 3 1 3 1 1 3 1 3 2 3 1 3 1 1 3 2 3 2 2 1 3 3 2 2 2 2 3 3 1 1 1 1 2 1 1 1 3 1 3 2 1 2 1 3 3 2 2 2 1 2 2 2 1 3 2 1 3 2 1 2 2 2 2 1 1 3 2 1 1 2 1 1 1 1 1 3 1 2 2 2 3 2 3 2 3 3 2 3 2 3 2 1 3 3 3 3 3 2 1 3 1 3 1 3 1 1 3 2 1 3 1 3 1 2 1 3 3 1\\r\\n5 38 67 92 180 132\\r\\n4 119 69 116 67\\r\\n0\\r\\n1 135\\r\\n9 193 67 122 7 15 45 2 180 129\\r\\n2 143 195\\r\\n3 176 38 175\\r\\n0...', 'output': ['212']}, {'input': '200\\r\\n2 3 3 1 1 1 3 3 3 3 1 1 1 1 2 2 2 2 2 1 3 1 2 3 1 1 1 3 2 2 1 2 2 3 3 2 3 2 2 2 3 2 3 3 2 2 1 2 3 3 1 1 1 2 2 3 1 2 1 3 3 2 1 3 3 3 2 2 1 2 3 2 2 1 2 1 2 2 1 3 3 2 2 3 3 2 3 1 3 3 1 2 1 1 1 3 1 2 1 2 3 1 3 2 2 1 2 3 1 2 3 3 1 2 1 1 2 2 2 1 3 2 3 3 2 1 2 3 3 3 1 2 3 1 1 1 2 1 3 3 2 3 1 1 2 2 1 3 3 3 3 2 3 2 2 1 1 2 3 1 3 1 3 3 3 3 1 3 2 3 2 2 3 2 3 1 2 2 2 3 2 2 1 1 1 3 1 3 1 2 1 3 1 1 3 2 2 2 3 1\\r\\n2 14 181\\r\\n3 83 181 61\\r\\n3 59 181 60\\r\\n4 181 164 72 138\\r\\n2 109 181\\r\\n3 176 181 79\\r\\n5 118 109 181 135 142\\r\\n2 1...', 'output': ['215']}, {'input': '200\\r\\n3 3 2 2 3 2 1 1 1 1 3 3 1 2 2 2 1 1 3 1 3 3 1 2 3 1 3 2 3 2 2 3 2 2 2 3 1 2 2 1 1 3 3 1 3 3 2 1 3 2 1 1 3 3 2 1 3 1 1 2 3 2 1 2 3 1 2 2 3 1 2 1 1 3 1 3 2 3 1 3 1 3 2 2 2 1 2 1 2 2 2 2 3 1 2 1 1 2 3 3 1 2 1 2 1 2 2 3 2 2 3 2 1 3 2 1 1 1 3 3 3 2 2 3 2 2 3 3 2 1 1 2 1 1 3 3 2 2 3 1 1 2 2 2 3 1 3 2 3 2 2 1 2 1 3 2 2 3 1 2 1 2 2 1 3 3 2 2 3 2 3 2 3 2 1 1 1 3 2 2 1 3 2 2 1 1 2 3 1 1 1 1 2 2 1 2 3 3 1 3\\r\\n110 6 89 9 11 54 82 39 183 22 93 96 109 24 42 45 104 75 190 147 90 68 188 133 62 117 139 154 91 177 44 92...', 'output': ['346']}, {'input': '200\\r\\n1 1 1 3 2 3 1 2 2 2 1 1 1 3 2 2 3 1 1 2 1 2 1 2 2 3 2 2 2 2 1 3 1 1 1 3 2 2 3 2 3 3 1 2 1 1 2 3 1 1 2 3 2 3 1 1 2 1 2 1 2 3 2 3 1 1 2 1 1 3 2 2 1 1 1 2 1 1 1 1 1 3 1 1 3 3 3 1 3 2 1 2 1 1 1 3 1 1 3 2 3 1 1 3 3 1 1 1 1 1 3 2 2 3 1 1 2 3 3 1 1 3 3 2 3 2 2 1 2 3 3 1 1 1 1 3 3 2 3 2 3 3 3 2 3 1 2 2 3 1 3 2 1 3 1 2 3 3 1 1 2 2 2 3 2 3 2 1 3 3 2 1 3 1 3 2 2 2 2 1 2 2 1 1 2 3 1 2 3 2 1 2 1 1 2 2 1 3 2 3\\r\\n23 109 172 111 25 46 157 144 72 156 94 110 22 60 98 118 171 189 86 42 117 186 8 161\\r\\n43 111 25 197 46 157...', 'output': ['338']}, {'input': '200\\r\\n3 2 3 1 2 1 2 3 3 1 3 2 3 1 1 3 3 2 2 2 1 2 2 3 1 1 1 2 3 3 2 3 3 2 3 2 2 1 3 3 2 1 3 3 2 2 1 1 1 2 3 1 3 3 2 3 1 3 3 3 3 3 3 2 2 1 2 3 3 1 2 1 1 1 3 1 1 3 1 1 2 2 2 2 3 3 3 1 1 2 3 2 1 3 2 2 1 2 3 1 2 3 3 3 3 3 2 1 1 3 3 2 3 1 3 3 3 1 2 1 2 2 1 1 3 2 1 1 1 3 3 3 3 2 2 1 3 2 1 2 3 2 1 1 1 1 3 2 3 1 2 1 1 3 2 2 3 1 3 1 2 3 1 1 3 2 2 1 3 2 2 3 1 1 2 2 2 1 1 2 3 1 1 1 2 2 2 2 2 2 1 3 3 2 1 3 2 3 3 1\\r\\n25 200 2 127 5 69 99 52 174 194 19 169 106 163 40 177 84 178 108 112 21 17 42 162 33 122\\r\\n1 200\\r\\n46 200 2...', 'output': ['335']}, {'input': '200\\r\\n2 2 3 3 3 1 3 3 1 3 2 3 2 3 2 3 1 1 1 3 3 3 2 2 3 3 2 1 3 1 1 3 3 3 3 3 1 2 3 2 3 2 1 1 1 3 3 2 2 3 2 1 2 3 1 2 2 2 3 3 3 2 3 2 3 3 3 1 2 2 1 2 3 3 3 1 1 3 3 1 2 1 1 3 3 1 2 3 1 3 3 2 2 3 2 3 1 1 2 1 1 3 1 3 2 2 2 3 1 2 1 1 2 3 2 2 1 1 3 1 1 3 1 2 1 1 3 1 2 3 1 2 3 2 3 1 1 3 1 1 2 1 1 2 3 3 1 3 1 1 3 1 3 2 3 1 2 2 1 2 1 2 3 3 3 1 2 3 2 1 3 3 3 1 1 3 2 3 2 3 1 2 2 3 1 3 1 2 2 1 2 3 1 3 2 1 3 3 3 2\\r\\n84 138 10 57 184 16 9 11 15 2 176 33 43 6 91 158 194 27 18 31 141 167 193 150 102 41 53 197 191 94 66 49 ...', 'output': ['339']}, {'input': '200\\r\\n2 2 3 1 3 2 2 3 3 1 2 3 1 1 2 1 3 3 2 3 3 3 3 3 3 2 2 1 3 1 1 1 2 3 3 1 1 3 1 2 3 3 3 1 2 1 3 3 2 1 3 2 1 3 2 2 3 3 1 3 3 1 2 2 2 2 3 3 1 1 2 3 3 1 1 3 1 1 2 3 2 2 3 3 1 2 1 3 3 1 1 3 2 2 2 1 2 1 1 3 2 1 2 3 3 3 3 1 1 3 1 1 1 2 3 1 2 2 3 1 1 2 3 3 1 3 3 3 2 1 1 2 2 3 3 1 3 3 1 1 1 3 2 1 2 2 2 3 3 1 1 1 3 2 3 3 2 3 3 2 3 2 1 1 3 2 1 3 3 1 2 2 2 3 1 1 2 3 2 2 3 2 1 2 2 1 1 2 2 1 3 2 3 2 1 2 1 2 2 3\\r\\n0\\r\\n43 1 121 139 184 5 124 152 43 197 25 149 186 23 94 80 188 91 187 68 49 176 153 169 36 110 26 38 3 195 ...', 'output': ['387']}, {'input': '200\\r\\n2 3 1 2 3 2 3 2 2 3 2 2 1 2 3 1 1 2 3 2 3 1 1 1 2 1 3 1 1 1 3 3 3 2 3 1 2 2 2 3 2 3 3 3 2 1 3 1 2 1 1 1 3 3 2 3 2 2 3 2 3 3 3 2 2 3 3 2 2 3 1 3 3 2 3 1 2 1 2 1 3 3 2 1 1 2 3 3 2 1 2 1 2 1 1 3 2 2 1 3 3 3 2 1 1 3 2 3 1 1 3 3 2 1 3 1 2 2 2 1 3 3 3 1 1 2 2 1 1 2 3 3 1 3 3 3 3 2 3 1 3 2 1 3 1 1 3 1 2 2 1 3 3 2 1 3 1 2 2 1 2 2 1 1 1 1 1 1 2 2 2 1 3 2 1 3 1 3 1 2 2 2 1 2 1 2 3 3 1 3 2 3 1 2 1 2 3 1 3 1\\r\\n48 98 53 140 115 193 33 91 105 9 19 143 72 194 84 88 90 17 30 52 71 36 118 23 21 180 51 27 81 178 95 43 9...', 'output': ['411']}, {'input': '200\\r\\n1 1 1 3 2 3 1 2 2 3 2 3 2 3 2 3 2 3 2 1 3 2 2 2 2 1 1 3 1 1 3 2 3 2 1 1 3 1 3 3 1 2 1 3 3 3 2 1 2 2 3 1 1 2 3 3 1 1 1 3 2 2 1 3 2 3 3 1 2 1 1 3 1 3 1 3 2 2 1 1 2 1 2 3 2 1 3 3 3 1 2 1 3 3 1 3 2 3 3 1 3 1 1 3 2 3 2 3 1 3 3 3 2 2 3 2 1 2 2 3 2 1 3 3 2 2 2 2 3 3 1 1 2 2 3 2 2 2 2 1 1 2 3 1 2 2 1 1 2 2 2 2 1 2 3 2 1 1 1 2 3 2 3 1 3 3 2 1 1 2 2 3 1 3 3 2 2 1 2 2 3 1 2 1 2 3 2 2 3 1 3 1 2 1 3 3 2 2 1 2\\r\\n85 58 117 3 98 12 35 75 167 155 18 169 88 22 145 132 49 29 71 184 161 9 142 153 189 67 118 112 26 92 139 ...', 'output': ['381']}, {'input': '200\\r\\n2 1 2 2 2 2 1 3 2 3 1 3 3 1 3 3 2 2 2 2 1 3 1 1 2 1 3 2 3 2 2 1 1 1 2 1 2 2 2 1 3 1 1 1 1 1 2 2 1 1 3 1 1 2 1 1 3 2 2 2 3 2 1 1 2 3 1 1 2 1 3 1 3 1 1 2 1 2 3 3 3 3 2 2 2 2 1 3 2 1 3 1 2 3 3 1 3 2 1 1 2 3 2 1 3 2 3 3 3 3 1 2 1 2 3 2 2 1 1 3 1 2 3 2 3 2 1 1 1 3 2 3 1 2 1 1 2 1 3 1 2 1 1 2 3 1 3 3 1 3 2 3 1 1 1 3 1 3 1 1 2 1 2 3 2 3 3 3 2 3 1 3 1 2 3 1 3 1 1 1 3 1 2 3 1 1 2 3 3 1 1 2 2 1 3 2 3 1 2 1\\r\\n131 141 103 74 113 45 96 142 55 196 126 6 77 139 102 15 194 34 105 158 145 187 134 27 162 100 57 8 183 29...', 'output': ['391']}, {'input': '200\\r\\n3 1 3 3 1 3 3 2 1 2 2 3 3 2 1 1 1 2 2 2 2 2 3 1 1 3 1 1 1 3 3 3 2 2 3 3 3 1 1 1 1 3 1 3 3 2 1 3 2 3 3 3 2 2 3 1 2 3 1 2 3 2 2 2 3 2 1 3 2 1 2 3 1 2 1 2 2 3 3 3 2 1 1 3 2 1 1 2 2 1 1 3 2 3 2 2 3 1 3 2 2 1 1 3 2 1 1 2 2 1 2 2 2 2 1 3 2 2 1 1 2 1 1 1 2 1 1 2 3 1 3 1 3 3 3 2 3 1 3 3 2 2 2 3 1 2 1 2 3 2 1 2 2 2 1 3 2 2 1 2 2 3 2 2 3 3 1 1 3 1 2 2 2 3 1 2 3 3 2 3 3 2 3 2 3 2 3 2 2 3 1 2 1 1 2 3 3 1 1 2\\r\\n28 123 137 3 177 73 48 126 94 112 66 186 197 78 26 181 180 187 117 142 29 189 31 191 24 125 45 200 140\\r\\n1...', 'output': ['390']}, {'input': '200\\r\\n1 1 1 2 3 1 3 2 1 1 1 1 1 3 2 3 1 2 2 1 2 2 2 1 1 2 2 2 2 3 3 3 3 3 2 3 1 3 1 1 3 3 2 1 2 2 3 2 1 2 1 3 3 3 2 2 1 2 1 1 1 2 2 1 3 3 3 1 1 2 1 2 1 3 2 1 2 2 2 3 3 1 2 2 2 1 2 3 2 3 1 2 1 3 2 3 1 2 1 3 3 2 1 3 1 2 2 2 1 2 1 2 3 3 3 3 1 3 1 2 1 1 1 2 2 1 2 3 3 1 1 2 3 3 3 2 3 1 1 3 1 1 3 3 3 1 1 3 1 2 3 3 2 3 3 3 2 1 1 1 1 2 3 2 3 3 2 1 3 1 2 3 2 1 1 3 3 2 1 3 3 1 1 1 2 3 1 3 1 3 3 2 3 3 1 1 1 3 3 1\\r\\n141 15 147 168 123 32 99 115 22 9 10 125 79 96 145 126 59 17 20 188 124 21 172 23 14 177 26 112 150 54 47...', 'output': ['383']}, {'input': '200\\r\\n3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 2 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 2 3 1\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n...', 'output': ['202']}, {'input': '200\\r\\n3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 3\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n0\\r\\n...', 'output': ['201']}, {'input': '200\\r\\n1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2\\r\\n0\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n1 1\\r\\n1 5\\r\\n1 5\\r\\n1 6\\r\\n1 7\\r\\n1 8\\r\\n1 5\\r\\n1 8\\r\\n1 6\\r\\n1 12\\r\\n1 14\\r\\n1 2\\r\\n1 12\\r\\n1 4\\r\\n1 9\\r\\n1 2\\r\\n1 17...', 'output': ['214']}, {'input': '4\\r\\n1 1 2 3\\r\\n1 2\\r\\n1 3\\r\\n0\\r\\n1 1\\r\\n', 'output': ['8']}, {'input': '15\\r\\n3 2 2 2 1 1 2 1 1 2 2 3 3 3 2\\r\\n1 13\\r\\n4 13 1 8 14\\r\\n10 5 13 1 8 14 4 2 11 15 10\\r\\n6 5 13 1 8 9 14\\r\\n0\\r\\n11 5 13 1 8 14 4 2 11 10 3 12\\r\\n11 13 1 8 14 4 2 11 15 10 3 6\\r\\n2 13 1\\r\\n4 5 13 1 8\\r\\n8 5 13 1 8 14 2 11 15\\r\\n6 5 13 1 8 14 2\\r\\n10 5 13 1 8 14 2 11 15 10 3\\r\\n0...', 'output': ['23']}, {'input': '17\\r\\n2 3 1 3 3 3 1 1 1 2 2 2 3 2 3 3 2\\r\\n5 4 14 2 11 7\\r\\n3 13 4 14\\r\\n7 6 4 14 2 1 10 12\\r\\n2 6 13\\r\\n9 4 2 9 8 7 17 1 10 12\\r\\n0\\r\\n5 4 14 2 9 11\\r\\n4 13 4 2 11\\r\\n4 13 4 14 2\\r\\n7 13 4 2 11 8 7 1\\r\\n4 13 4 14 2\\r\\n8 6 4 2 8 7 17 1 10\\r\\n0\\r\\n1 4\\r\\n7 13 4 14 2 9 8 7\\r\\n6 4 2 17 1 10 ...', 'output': ['27']}, {'input': '18\\r\\n1 2 3 3 2 2 1 1 3 1 2 3 2 3 1 2 2 3\\r\\n5 9 3 14 12 2\\r\\n7 9 4 3 14 16 7 12\\r\\n1 9\\r\\n1 9\\r\\n6 9 14 12 1 6 15\\r\\n6 9 14 12 2 1 11\\r\\n2 9 14\\r\\n7 9 14 7 12 2 1 6\\r\\n0\\r\\n6 9 18 14 7 1 6\\r\\n4 9 14 7 1\\r\\n2 9 14\\r\\n6 9 3 14 7 1 6\\r\\n2 9 3\\r\\n9 9 3 14 16 12 2 1 6 17\\r\\n4 9 4 18 14\\r\\n8 9 1...', 'output': ['26']}, {'input': '19\\r\\n2 3 3 2 3 1 3 1 2 2 2 1 1 1 2 2 1 3 3\\r\\n0\\r\\n3 1 10 6\\r\\n8 1 6 2 17 18 12 15 7\\r\\n5 6 2 9 17 18\\r\\n6 6 2 17 18 12 16\\r\\n1 11\\r\\n9 1 11 6 2 17 18 4 12 15\\r\\n3 1 6 2\\r\\n4 1 6 2 8\\r\\n0\\r\\n1 1\\r\\n5 1 6 2 17 18\\r\\n12 1 10 6 2 8 17 18 4 12 15 7 3\\r\\n10 11 6 2 17 18 4 12 16 15 7\\r\\n8 1 ...', 'output': ['30']}, {'input': '20\\r\\n2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1\\r\\n1 7\\r\\n13 7 1 11 4 6 16 20 12 5 18 19 15 10\\r\\n8 7 1 11 4 6 17 8 16\\r\\n3 7 1 11\\r\\n9 7 1 11 4 6 8 20 12 3\\r\\n4 7 1 11 4\\r\\n0\\r\\n6 7 1 11 4 6 17\\r\\n4 7 1 11 4\\r\\n7 7 1 11 4 6 17 5\\r\\n2 7 1\\r\\n9 7 1 11 4 6 17 8 14 20\\r\\n11 7 1 11 4 6 20...', 'output': ['35']}, {'input': '200\\r\\n3 3 3 1 3 1 3 1 1 1 3 2 1 1 3 1 3 3 2 2 2 2 3 3 1 3 2 3 1 2 3 3 2 2 1 2 3 3 1 3 1 3 3 3 1 2 1 3 3 1 2 1 2 3 2 2 3 2 2 3 2 3 1 1 1 2 2 2 1 3 1 2 1 3 2 3 2 1 2 2 1 1 2 2 1 3 3 2 2 1 3 2 3 2 3 1 2 2 2 3 3 2 2 3 2 3 3 3 3 3 2 2 3 3 2 3 2 1 2 3 2 3 2 1 2 ...', 'output': ['224']}, {'input': '200\\r\\n1 2 3 2 1 1 3 3 3 3 2 1 1 2 3 3 1 3 2 3 1 3 3 1 2 3 3 2 2 1 3 3 3 3 1 1 2 2 2 2 2 1 1 2 3 2 3 3 3 2 2 1 2 3 2 1 1 1 1 1 3 2 2 2 2 1 3 1 2 2 3 1 1 2 1 1 1 1 2 2 2 1 3 2 1 1 2 2 2 1 1 3 1 3 3 1 3 3 2 3 2 2 3 1 3 3 1 3 3 3 3 2 1 3 1 3 2 2 1 3 2 2 3 1 2 ...', 'output': ['220']}, {'input': '200\\r\\n1 3 2 3 2 3 3 3 2 2 3 2 3 1 1 3 3 2 2 2 1 1 3 3 3 1 1 1 1 2 2 3 1 3 2 3 3 2 1 2 3 2 2 1 2 1 3 3 3 1 3 3 3 2 2 1 3 3 1 1 2 1 2 2 3 3 3 2 1 2 2 2 2 3 2 1 3 1 3 2 2 2 1 3 2 2 3 3 1 3 3 1 3 1 1 2 3 1 1 2 3 1 3 2 1 1 2 2 2 1 1 3 3 1 1 3 1 1 2 1 3 2 1 2 2 ...', 'output': ['219']}, {'input': '200\\r\\n1 3 3 1 1 2 1 3 2 2 3 2 2 1 3 1 1 3 3 2 3 3 2 3 2 3 1 2 3 3 2 2 3 3 1 3 3 1 1 1 2 1 1 1 2 2 2 3 2 3 2 1 1 3 2 3 2 1 1 3 3 1 3 1 3 3 3 3 1 2 3 2 1 1 1 2 1 3 2 3 2 1 3 3 2 2 3 3 1 2 1 3 1 2 2 1 1 3 3 3 3 2 1 1 2 1 3 1 3 3 1 2 1 2 1 2 2 1 3 1 2 3 2 3 2 ...', 'output': ['222']}, {'input': '200\\r\\n3 1 2 3 2 1 3 2 2 1 3 1 1 1 3 1 3 3 1 1 3 1 2 2 2 1 3 3 2 1 3 2 3 3 3 2 2 1 3 1 2 1 3 2 2 2 2 1 1 2 2 3 1 2 1 3 2 3 2 1 2 1 2 3 3 2 2 2 2 1 2 2 1 2 3 1 1 1 3 3 1 3 2 3 1 2 2 1 2 2 3 3 1 1 1 2 1 1 3 1 3 2 2 1 3 1 2 3 1 3 2 3 3 3 1 3 1 2 3 3 2 2 2 2 2 ...', 'output': ['223']}, {'input': '200\\r\\n3 2 2 1 3 2 2 3 1 1 2 3 3 1 2 2 3 3 1 1 3 3 3 1 1 3 2 3 2 3 3 2 2 1 3 2 1 2 3 1 1 3 3 2 3 1 1 2 3 2 1 3 2 2 3 3 1 1 1 3 2 1 3 1 2 1 2 1 2 3 1 3 2 2 1 1 1 1 3 2 1 1 1 1 3 1 3 1 3 3 1 2 2 2 1 2 3 1 2 3 1 1 2 3 3 3 1 3 2 2 2 2 2 2 3 1 1 3 1 3 1 1 3 3 1 ...', 'output': ['222']}, {'input': '200\\r\\n1 2 3 3 1 2 1 1 2 1 1 1 1 2 3 3 3 1 2 2 2 2 3 2 1 2 2 3 3 1 1 3 1 1 1 3 1 3 3 2 2 3 3 3 2 3 1 1 1 1 2 3 2 3 3 3 1 1 3 3 1 2 3 1 3 1 3 2 3 2 1 3 1 1 1 2 1 3 2 2 2 3 2 2 2 2 1 3 3 3 3 1 3 1 2 1 2 1 2 1 2 3 2 3 1 3 1 2 1 1 2 3 3 1 2 1 1 1 1 2 3 1 1 1 2 ...', 'output': ['219']}, {'input': '200\\r\\n3 1 3 3 2 1 2 1 1 3 3 3 2 3 2 3 3 2 1 1 2 3 2 2 1 1 2 2 2 3 3 2 2 3 2 1 2 3 1 1 3 1 1 2 2 2 3 3 2 2 3 2 3 1 2 2 2 1 3 1 3 3 3 2 3 2 2 1 2 1 1 3 2 2 3 3 2 3 2 1 2 3 3 3 3 1 2 1 1 3 1 3 1 2 2 1 3 1 1 2 2 3 1 3 1 2 3 3 2 1 2 1 2 1 2 3 2 1 1 2 1 3 1 3 1 ...', 'output': ['221']}, {'input': '200\\r\\n2 1 1 3 2 1 3 2 1 2 2 2 3 1 3 1 3 3 2 2 2 3 1 2 1 2 1 2 1 3 1 3 2 2 2 2 2 2 3 2 3 2 3 2 2 3 2 3 2 3 2 3 3 1 1 3 2 3 3 1 3 2 1 1 1 3 1 2 2 2 2 1 2 3 2 1 1 3 1 1 3 2 1 3 2 2 1 2 1 2 1 3 2 2 2 1 2 1 2 3 3 3 1 1 2 2 3 3 3 3 1 3 1 2 1 3 1 2 2 2 2 1 2 1 2 ...', 'output': ['216']}, {'input': '200\\r\\n1 2 1 3 2 1 1 3 3 3 1 3 1 2 1 1 3 2 2 3 2 3 1 2 2 3 2 3 2 3 2 1 3 1 3 3 3 3 2 3 2 2 3 3 2 3 2 2 1 3 2 2 2 1 2 1 2 3 3 1 3 1 2 1 1 2 2 1 1 2 3 3 2 2 1 3 1 2 2 2 1 2 2 3 3 2 1 1 1 1 2 1 3 1 3 2 1 3 3 2 1 2 3 1 3 2 2 2 3 3 2 1 3 3 2 2 3 1 3 1 2 2 3 1 3 ...', 'output': ['219']}, {'input': '200\\r\\n3 3 2 3 2 3 1 3 2 2 1 3 2 2 1 3 1 3 3 3 2 2 2 2 1 1 3 1 1 2 1 3 1 3 2 1 1 2 3 3 2 3 1 1 3 2 2 2 3 2 1 3 3 2 3 2 2 2 3 3 2 3 2 3 1 2 2 3 3 2 3 3 1 3 1 3 1 1 1 3 1 1 2 3 2 1 1 1 2 2 2 2 3 2 1 2 3 1 3 3 1 2 2 1 2 1 1 3 3 3 1 1 2 3 1 2 3 2 2 1 2 2 3 1 3 ...', 'output': ['213']}, {'input': '200\\r\\n3 2 2 2 2 3 1 1 1 2 2 2 3 2 3 3 3 1 3 2 3 1 2 2 1 1 1 3 1 3 1 1 1 1 2 3 3 1 3 1 2 2 1 2 3 2 1 2 2 1 1 2 1 2 3 1 3 1 1 2 1 3 2 3 1 2 2 3 1 3 2 2 2 1 1 2 1 1 2 2 1 2 2 2 2 2 3 1 3 2 2 1 3 2 2 2 3 1 3 1 3 1 1 1 2 1 1 3 3 1 3 2 3 3 1 3 3 2 1 1 3 1 1 2 3 ...', 'output': ['210']}, {'input': '200\\r\\n2 1 2 3 2 2 1 2 2 2 1 3 2 2 2 2 1 1 3 2 2 2 3 3 3 1 2 3 2 1 2 2 1 3 3 2 1 3 3 1 1 2 2 2 3 1 2 3 1 1 3 3 1 1 1 1 2 2 1 2 2 2 3 2 2 1 2 3 3 2 2 3 3 3 2 1 1 2 1 1 1 2 3 3 2 3 1 2 3 1 3 1 1 1 3 1 1 1 1 3 2 3 3 2 2 1 1 2 2 1 1 1 2 3 1 3 3 2 2 1 1 3 1 1 2 ...', 'output': ['210']}, {'input': '200\\r\\n3 1 1 1 3 3 3 1 3 3 1 3 1 2 3 3 3 2 1 2 2 3 3 1 1 3 2 1 3 2 1 2 3 2 2 1 1 2 2 1 1 3 2 2 1 2 2 1 2 2 1 3 1 2 3 1 3 3 1 3 1 3 2 3 2 2 1 2 3 2 1 3 2 3 1 1 1 1 1 1 2 2 3 2 3 3 3 1 3 1 2 3 1 1 3 2 3 2 1 1 3 2 2 2 3 2 1 3 2 1 3 2 3 2 2 1 2 1 2 1 3 2 1 2 1 ...', 'output': ['212']}, {'input': '200\\r\\n1 1 3 3 2 2 2 2 2 3 2 3 1 1 1 2 2 2 3 3 1 1 2 1 3 1 3 2 2 2 3 1 3 2 3 2 2 3 1 1 3 3 2 3 3 3 2 2 1 2 3 3 2 2 1 3 2 1 2 3 1 3 2 1 1 1 2 1 3 1 1 3 2 3 1 2 3 3 2 1 2 1 2 3 3 3 1 1 3 3 2 3 3 1 2 2 3 1 3 3 2 1 3 3 2 2 3 2 2 3 1 2 2 3 2 3 2 3 1 3 1 1 3 2 2 ...', 'output': ['208']}, {'input': '200\\r\\n2 2 2 3 2 1 1 2 3 1 3 2 1 1 1 2 2 2 3 1 3 3 2 1 1 2 1 3 1 3 3 1 1 3 2 1 3 2 2 3 1 2 3 2 2 2 3 3 1 1 3 3 1 2 3 2 3 2 1 1 2 3 3 2 3 3 2 1 3 2 2 3 1 2 2 2 2 2 3 2 3 3 2 3 3 3 3 1 2 2 2 1 3 2 1 1 2 1 3 1 1 3 3 1 1 2 1 2 2 3 1 1 2 1 1 1 2 3 2 2 1 1 1 1 3 ...', 'output': ['213']}, {'input': '200\\r\\n3 3 1 3 2 3 2 3 1 3 3 1 1 2 3 1 2 2 2 3 2 2 2 2 1 3 3 2 2 2 3 3 3 3 1 1 3 1 3 1 2 1 2 3 2 2 3 3 3 3 1 3 1 3 1 3 3 3 2 2 1 1 2 1 2 2 2 2 1 2 1 1 2 3 2 3 2 2 2 3 3 3 3 3 2 2 1 1 1 2 1 1 2 3 2 3 1 3 1 1 1 3 3 2 3 2 1 3 1 3 1 2 2 2 2 1 1 2 2 3 2 1 2 2 3 ...', 'output': ['215']}, {'input': '200\\r\\n1 2 3 1 1 1 2 2 2 2 1 2 1 2 3 2 2 3 2 1 2 1 1 2 2 1 2 2 3 1 2 3 3 3 1 1 1 2 1 1 1 1 1 1 1 2 3 2 1 1 3 2 1 2 1 1 3 3 1 3 2 3 2 1 3 3 3 3 1 1 3 3 3 1 2 1 1 1 1 1 1 1 1 2 1 3 3 1 2 1 2 1 2 2 1 2 1 2 3 3 2 2 2 1 1 2 2 3 3 1 1 1 2 2 3 1 3 2 1 3 1 2 1 1 2 ...', 'output': ['213']}, {'input': '200\\r\\n2 3 1 2 1 3 2 1 1 2 1 2 3 3 1 2 1 3 3 2 1 1 3 1 2 3 3 3 1 1 3 1 1 1 2 3 3 3 1 2 3 2 2 1 2 3 3 1 1 2 1 3 3 1 2 3 3 2 2 1 2 1 2 1 3 2 2 3 2 2 1 1 3 3 2 2 1 1 3 1 1 1 3 1 3 1 1 3 1 3 2 3 1 3 1 1 3 2 3 2 2 1 3 3 2 2 2 2 3 3 1 1 1 1 2 1 1 1 3 1 3 2 1 2 1 ...', 'output': ['212']}, {'input': '200\\r\\n2 3 3 1 1 1 3 3 3 3 1 1 1 1 2 2 2 2 2 1 3 1 2 3 1 1 1 3 2 2 1 2 2 3 3 2 3 2 2 2 3 2 3 3 2 2 1 2 3 3 1 1 1 2 2 3 1 2 1 3 3 2 1 3 3 3 2 2 1 2 3 2 2 1 2 1 2 2 1 3 3 2 2 3 3 2 3 1 3 3 1 2 1 1 1 3 1 2 1 2 3 1 3 2 2 1 2 3 1 2 3 3 1 2 1 1 2 2 2 1 3 2 3 3 2 ...', 'output': ['215']}, {'input': '200\\r\\n3 3 2 2 3 2 1 1 1 1 3 3 1 2 2 2 1 1 3 1 3 3 1 2 3 1 3 2 3 2 2 3 2 2 2 3 1 2 2 1 1 3 3 1 3 3 2 1 3 2 1 1 3 3 2 1 3 1 1 2 3 2 1 2 3 1 2 2 3 1 2 1 1 3 1 3 2 3 1 3 1 3 2 2 2 1 2 1 2 2 2 2 3 1 2 1 1 2 3 3 1 2 1 2 1 2 2 3 2 2 3 2 1 3 2 1 1 1 3 3 3 2 2 3 2 ...', 'output': ['346']}, {'input': '200\\r\\n1 1 1 3 2 3 1 2 2 2 1 1 1 3 2 2 3 1 1 2 1 2 1 2 2 3 2 2 2 2 1 3 1 1 1 3 2 2 3 2 3 3 1 2 1 1 2 3 1 1 2 3 2 3 1 1 2 1 2 1 2 3 2 3 1 1 2 1 1 3 2 2 1 1 1 2 1 1 1 1 1 3 1 1 3 3 3 1 3 2 1 2 1 1 1 3 1 1 3 2 3 1 1 3 3 1 1 1 1 1 3 2 2 3 1 1 2 3 3 1 1 3 3 2 3 ...', 'output': ['338']}, {'input': '200\\r\\n3 2 3 1 2 1 2 3 3 1 3 2 3 1 1 3 3 2 2 2 1 2 2 3 1 1 1 2 3 3 2 3 3 2 3 2 2 1 3 3 2 1 3 3 2 2 1 1 1 2 3 1 3 3 2 3 1 3 3 3 3 3 3 2 2 1 2 3 3 1 2 1 1 1 3 1 1 3 1 1 2 2 2 2 3 3 3 1 1 2 3 2 1 3 2 2 1 2 3 1 2 3 3 3 3 3 2 1 1 3 3 2 3 1 3 3 3 1 2 1 2 2 1 1 3 ...', 'output': ['335']}, {'input': '200\\r\\n2 2 3 3 3 1 3 3 1 3 2 3 2 3 2 3 1 1 1 3 3 3 2 2 3 3 2 1 3 1 1 3 3 3 3 3 1 2 3 2 3 2 1 1 1 3 3 2 2 3 2 1 2 3 1 2 2 2 3 3 3 2 3 2 3 3 3 1 2 2 1 2 3 3 3 1 1 3 3 1 2 1 1 3 3 1 2 3 1 3 3 2 2 3 2 3 1 1 2 1 1 3 1 3 2 2 2 3 1 2 1 1 2 3 2 2 1 1 3 1 1 3 1 2 1 ...', 'output': ['339']}, {'input': '200\\r\\n2 2 3 1 3 2 2 3 3 1 2 3 1 1 2 1 3 3 2 3 3 3 3 3 3 2 2 1 3 1 1 1 2 3 3 1 1 3 1 2 3 3 3 1 2 1 3 3 2 1 3 2 1 3 2 2 3 3 1 3 3 1 2 2 2 2 3 3 1 1 2 3 3 1 1 3 1 1 2 3 2 2 3 3 1 2 1 3 3 1 1 3 2 2 2 1 2 1 1 3 2 1 2 3 3 3 3 1 1 3 1 1 1 2 3 1 2 2 3 1 1 2 3 3 1 ...', 'output': ['387']}, {'input': '200\\r\\n2 3 1 2 3 2 3 2 2 3 2 2 1 2 3 1 1 2 3 2 3 1 1 1 2 1 3 1 1 1 3 3 3 2 3 1 2 2 2 3 2 3 3 3 2 1 3 1 2 1 1 1 3 3 2 3 2 2 3 2 3 3 3 2 2 3 3 2 2 3 1 3 3 2 3 1 2 1 2 1 3 3 2 1 1 2 3 3 2 1 2 1 2 1 1 3 2 2 1 3 3 3 2 1 1 3 2 3 1 1 3 3 2 1 3 1 2 2 2 1 3 3 3 1 1 ...', 'output': ['411']}, {'input': '200\\r\\n1 1 1 3 2 3 1 2 2 3 2 3 2 3 2 3 2 3 2 1 3 2 2 2 2 1 1 3 1 1 3 2 3 2 1 1 3 1 3 3 1 2 1 3 3 3 2 1 2 2 3 1 1 2 3 3 1 1 1 3 2 2 1 3 2 3 3 1 2 1 1 3 1 3 1 3 2 2 1 1 2 1 2 3 2 1 3 3 3 1 2 1 3 3 1 3 2 3 3 1 3 1 1 3 2 3 2 3 1 3 3 3 2 2 3 2 1 2 2 3 2 1 3 3 2 ...', 'output': ['381']}, {'input': '200\\r\\n2 1 2 2 2 2 1 3 2 3 1 3 3 1 3 3 2 2 2 2 1 3 1 1 2 1 3 2 3 2 2 1 1 1 2 1 2 2 2 1 3 1 1 1 1 1 2 2 1 1 3 1 1 2 1 1 3 2 2 2 3 2 1 1 2 3 1 1 2 1 3 1 3 1 1 2 1 2 3 3 3 3 2 2 2 2 1 3 2 1 3 1 2 3 3 1 3 2 1 1 2 3 2 1 3 2 3 3 3 3 1 2 1 2 3 2 2 1 1 3 1 2 3 2 3 ...', 'output': ['391']}, {'input': '200\\r\\n3 1 3 3 1 3 3 2 1 2 2 3 3 2 1 1 1 2 2 2 2 2 3 1 1 3 1 1 1 3 3 3 2 2 3 3 3 1 1 1 1 3 1 3 3 2 1 3 2 3 3 3 2 2 3 1 2 3 1 2 3 2 2 2 3 2 1 3 2 1 2 3 1 2 1 2 2 3 3 3 2 1 1 3 2 1 1 2 2 1 1 3 2 3 2 2 3 1 3 2 2 1 1 3 2 1 1 2 2 1 2 2 2 2 1 3 2 2 1 1 2 1 1 1 2 ...', 'output': ['390']}, {'input': '200\\r\\n1 1 1 2 3 1 3 2 1 1 1 1 1 3 2 3 1 2 2 1 2 2 2 1 1 2 2 2 2 3 3 3 3 3 2 3 1 3 1 1 3 3 2 1 2 2 3 2 1 2 1 3 3 3 2 2 1 2 1 1 1 2 2 1 3 3 3 1 1 2 1 2 1 3 2 1 2 2 2 3 3 1 2 2 2 1 2 3 2 3 1 2 1 3 2 3 1 2 1 3 3 2 1 3 1 2 2 2 1 2 1 2 3 3 3 3 1 3 1 2 1 1 1 2 2 ...', 'output': ['383']}, {'input': '200\\r\\n3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 ...', 'output': ['201', '202']}, {'input': '200\\r\\n1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 ...', 'output': ['214']}]","id":107} {"description":"The city of D consists of n towers, built consecutively on a straight line. The height of the tower that goes i-th (from left to right) in the sequence equals hi. The city mayor decided to rebuild the city to make it beautiful. In a beautiful city all towers are are arranged in non-descending order of their height from left to right.The rebuilding consists of performing several (perhaps zero) operations. An operation constitutes using a crane to take any tower and put it altogether on the top of some other neighboring tower. In other words, we can take the tower that stands i-th and put it on the top of either the (i\u2009-\u20091)-th tower (if it exists), or the (i\u2009+\u20091)-th tower (of it exists). The height of the resulting tower equals the sum of heights of the two towers that were put together. After that the two towers can't be split by any means, but more similar operations can be performed on the resulting tower. Note that after each operation the total number of towers on the straight line decreases by 1.Help the mayor determine the minimum number of operations required to make the city beautiful.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20095000)\u00a0\u2014 the number of towers in the city. The next line contains n space-separated integers: the i-th number hi (1\u2009\u2264\u2009hi\u2009\u2264\u2009105) determines the height of the tower that is i-th (from left to right) in the initial tower sequence.","output_specification":"Print a single integer \u2014 the minimum number of operations needed to make the city beautiful.","notes":null,"sample_inputs":["5\n8 2 7 3 1","3\n5 2 1"],"sample_outputs":["3","2"],"src_uid":"1c74a21045b2d312f68565bdaaaa8a7b","lang_cluster":"Java","difficulty":2100,"human_solution":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\/\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n DTowers solver = new DTowers();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class DTowers {\n int MAXN = 5005;\n PrintWriter out;\n InputReader in;\n int n;\n long[] pf = new long[MAXN];\n long[][] dp = new long[MAXN][MAXN];\n\n long go(int ind, int last) {\n if (ind == n + 1)\n return 0;\n if (dp[ind][last] != -1)\n return dp[ind][last];\n long val = 1 + go(ind + 1, last);\n long last_sum = pf[ind - 1] - pf[last];\n int lo = ind, hi = n - 1;\n while (lo <= hi) {\n int mid = (lo + hi) >> 1;\n if (pf[mid] - pf[ind - 1] < last_sum)\n lo = mid + 1;\n else\n hi = mid - 1;\n }\n lo++;\n \/\/System.out.println(ind +\" \"+lo+\" \"+last);\n long nxt_sum = pf[lo - 1] - pf[ind - 1];\n if (pf[n] - pf[lo - 1] >= nxt_sum) {\n int len = lo - ind;\n long cost = len - 1;\n val = Math.min(val, go(lo, ind - 1) + cost);\n } else {\n int len = n + 1 - ind;\n long cost = len - 1;\n val = Math.min(val, go(n + 1, ind - 1) + cost);\n }\n dp[ind][last] = val;\n return val;\n }\n\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n this.out = out;\n this.in = in;\n n = ni();\n int i = 0;\n for (i = 1; i <= n; i++)\n pf[i] = pf[i - 1] + nl();\n for (i = 0; i <= n; i++)\n Arrays.fill(dp[i], -1);\n long min = (int) 1e9;\n if (n == 1) {\n pn(0);\n return;\n }\n for (i = 1; i <= n; i++) {\n \/\/pn(i);\n if (pf[n] - pf[i] >= pf[i]) {\n int len = i;\n long cost = len - 1;\n min = Math.min(min, go(i + 1, 0) + cost);\n } else {\n int len = n;\n long cost = len - 1;\n min = Math.min(min, go(n + 1, 0) + cost);\n }\n }\n pn(min);\n }\n\n int ni() {\n return in.nextInt();\n }\n\n long nl() {\n return in.nextLong();\n }\n\n void pn(long zx) {\n out.println(zx);\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new UnknownError();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new UnknownError();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}\n\n","testcases":"[{'input': '5\\r\\n8 2 7 3 1\\r\\n', 'output': ['3\\r\\n']}, {'input': '3\\r\\n5 2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n1 3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n16 8 4 2 1\\r\\n', 'output': ['4\\r\\n']}, {'input': '6\\r\\n5 5 2 3 5 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n4 4 4 4 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n5 4 2 13 5 2 21 2 20 1\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['7\\r\\n']}, {'input': '12\\r\\n5 1 3 2 3 3 2 2 2 1 3 2\\r\\n', 'output': ['7\\r\\n']}, {'input': '10\\r\\n1 2 4 8 1 2 8 16 4 1\\r\\n', 'output': ['4\\r\\n']}, {'input': '10\\r\\n6 6 6 6 4 4 4 3 3 2\\r\\n', 'output': ['4\\r\\n']}, {'input': '17\\r\\n8 6 1 2 3 6 2 2 2 6 6 1 1 1 1 1 1\\r\\n', 'output': ['12\\r\\n']}, {'input': '10\\r\\n982 825 689 538 970 73 40 735 930 719\\r\\n', 'output': ['6\\r\\n']}, {'input': '20\\r\\n131 883 492 278 77 934 244 539 929 253 442 84 862 282 141 4 13 843 287 646\\r\\n', 'output': ['15\\r\\n']}, {'input': '30\\r\\n632 292 647 666 184 442 449 695 281 786 52 576 124 927 273 771 217 56 135 624 162 406 341 30 343 137 658 318 394 71\\r\\n', 'output': ['23\\r\\n']}, {'input': '40\\r\\n780 349 449 406 290 950 653 500 281 320 14 67 386 572 404 538 421 270 983 602 464 611 718 636 912 678 697 203 775 309 764 132 59 801 713 826 759 51 945 742\\r\\n', 'output': ['30\\r\\n']}, {'input': '50\\r\\n929 406 604 146 397 811 858 656 632 853 624 559 648 216 183 305 977 483 831 228 117 465 95 891 834 219 88 440 156 547 319 920 540 15 513 371 473 129 290 462 315 815 470 511 151 851 96 52 259 825\\r\\n', 'output': ['40\\r\\n']}, {'input': '100\\r\\n981 756 746 449 425 692 211 546 943 980 556 784 426 943 496 742 488 515 753 435 188 875 373 618 415 506 660 446 82 398 244 987 442 588 32 351 832 802 195 104 724 167 109 183 253 847 329 906 640 691 739 639 987 341 560 627 573 809 443 411 180 550 881 154 450 100 435 946 164 688 174 798 1000 275 976 627 779 457 408 262 989 44 26 392 938 857 55 111 885 938 941 206 339 251 904 245 425 872 980 811\\r\\n', 'output': ['85\\r\\n']}, {'input': '17\\r\\n65536 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1\\r\\n', 'output': ['16\\r\\n']}, {'input': '5\\r\\n5 1 3 3 6\\r\\n', 'output': ['2\\r\\n']}]","id":108} {"description":"A piece of paper contains an array of n integers a1,\u2009a2,\u2009...,\u2009an. Your task is to find a number that occurs the maximum number of times in this array.However, before looking for such number, you are allowed to perform not more than k following operations \u2014 choose an arbitrary element from the array and add 1 to it. In other words, you are allowed to increase some array element by 1 no more than k times (you are allowed to increase the same element of the array multiple times).Your task is to find the maximum number of occurrences of some number in the array after performing no more than k allowed operations. If there are several such numbers, your task is to find the minimum one.","input_specification":"The first line contains two integers n and k (1\u2009\u2264\u2009n\u2009\u2264\u2009105; 0\u2009\u2264\u2009k\u2009\u2264\u2009109) \u2014 the number of elements in the array and the number of operations you are allowed to perform, correspondingly. The third line contains a sequence of n integers a1,\u2009a2,\u2009...,\u2009an (|ai|\u2009\u2264\u2009109) \u2014 the initial array. The numbers in the lines are separated by single spaces.","output_specification":"In a single line print two numbers \u2014 the maximum number of occurrences of some number in the array after at most k allowed operations are performed, and the minimum number that reaches the given maximum. Separate the printed numbers by whitespaces.","notes":"NoteIn the first sample your task is to increase the second element of the array once and increase the fifth element of the array twice. Thus, we get sequence 6,\u20094,\u20094,\u20090,\u20094, where number 4 occurs 3 times.In the second sample you don't need to perform a single operation or increase each element by one. If we do nothing, we get array 5,\u20095,\u20095, if we increase each by one, we get 6,\u20096,\u20096. In both cases the maximum number of occurrences equals 3. So we should do nothing, as number 5 is less than number 6.In the third sample we should increase the second array element once and the fifth element once. Thus, we get sequence 3,\u20092,\u20092,\u20092,\u20092, where number 2 occurs 4 times.","sample_inputs":["5 3\n6 3 4 0 2","3 4\n5 5 5","5 3\n3 1 2 2 1"],"sample_outputs":["3 4","3 5","4 2"],"src_uid":"3791d1a504b39eb2e72472bcfd9a7e22","lang_cluster":"Java","difficulty":1600,"human_solution":"\/\/ Main Code at the Bottom\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\nimport java.math.BigInteger; \npublic class Main {\n\t\/\/Fast IO class\n static class FastReader {\n BufferedReader br; \n StringTokenizer st; \n public FastReader() {\n \tboolean env=System.getProperty(\"ONLINE_JUDGE\") != null;\n \tif(!env) {\n \t\ttry {\n\t\t\t\t\tbr=new BufferedReader(new FileReader(\"src\\\\input.txt\"));\n\t\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n \t}\n \telse br = new BufferedReader(new InputStreamReader(System.in)); \n } \n String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) {\n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n int nextInt() {\n return Integer.parseInt(next()); \n } \n long nextLong() {\n return Long.parseLong(next()); \n } \n double nextDouble() {\n return Double.parseDouble(next()); \n } \n String nextLine() {\n String str = \"\"; \n try {\n str = br.readLine(); \n } \n catch (IOException e) {\n e.printStackTrace(); \n } \n return str; \n } \n } \n static long MOD=1000000000+7;\n \/\/debug\n static void debug(Object... o) {\n System.out.println(Arrays.deepToString(o));\n }\n \/\/ Pair\n static class pair{\n \tlong x,y;\n \tpair(long a,long b){\n \t\tthis.x=a;\n \t\tthis.y=b;\n \t}\n \tpublic boolean equals(Object obj) {\n \t\tif(obj == null || obj.getClass()!= this.getClass()) return false;\n pair p = (pair) obj;\n return (this.x==p.x && this.y==p.y);\n }\n \tpublic int hashCode() {\n return Objects.hash(x,y);\n }\n }\n static FastReader sc=new FastReader();\n static PrintWriter out=new PrintWriter(System.out); \n \/\/Main function(The main code starts from here)\n static int n,k;\n static long val=0;\n static long a[];\n static boolean check(int x) {\n \tlong sum=0;\n \tval=a[x-1];\n \tfor(int i=0;i0){\n \t\tn=sc.nextInt();k=sc.nextInt();a=new long[n];\n \t\tfor(int i=0;i0){\n String s = input.next();\n if(s.equals(\"defragment\")){\n for(int i=0, j=0;i 0) {solve();}\n pw.flush(); \n pw.close(); \n }\n \n\/******************************END OF MAIN PROGRAM*******************************************\/\n public static void init()throws IOException{if(System.getProperty(\"ONLINE_JUDGE\")==null){f=new FastScanner(\"\");}else{f=new FastScanner(System.in);}}\n public static class FastScanner {\n BufferedReader br;StringTokenizer st;\n FastScanner(InputStream stream){try{br=new BufferedReader(new InputStreamReader(stream));}catch(Exception e){e.printStackTrace();}}\n FastScanner(String str){try{br=new BufferedReader(new FileReader(\"!a.txt\"));}catch(Exception e){e.printStackTrace();}}\n String next(){while(st==null||!st.hasMoreTokens()){try{st=new StringTokenizer(br.readLine());}catch(IOException e){e.printStackTrace();}}return st.nextToken();}\n String nextLine()throws IOException{return br.readLine();}int ni(){return Integer.parseInt(next());}long nl(){return Long.parseLong(next());}double nextDouble(){return Double.parseDouble(next());}\n }\n public static void pn(Object o){pw.println(o);}\n public static void p(Object o){pw.print(o);}\n public static void pni(Object o){pw.println(o);pw.flush();}\n static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}\n static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}\n static long lcm(long a,long b){return (a*b\/gcd(a,b));}\n static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a\/b*y0;return temp;}\n static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}\n static long mpow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=((res%mod)*(a%mod))%mod;b>>=1;a=((a%mod)*(a%mod))%mod;}return res;}\n static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}\n static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}\n static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}\n static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}\n static HashSet factors(long n){HashSet hs=new HashSet();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n\/i);}}return hs;}\n static HashSet factors(int n){HashSet hs=new HashSet();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n\/i);}}return hs;}\n static HashSet pf(long n){HashSet ff=factors(n);HashSet ans=new HashSet();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}\n static HashSet pf(int n){HashSet ff=factors(n);HashSet ans=new HashSet();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}\n static int[] inpint(int n){int arr[]=new int[n];for(int i=0;i l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i a){Collections.sort(a);}\/\/!Precompute fact in ncr()!\n}","testcases":"[{'input': '800 600 4 3\\r\\n', 'output': ['800 600']}, {'input': '1920 1200 16 9\\r\\n', 'output': ['1920 1080']}, {'input': '1 1 1 2\\r\\n', 'output': ['0 0']}, {'input': '1002105126 227379125 179460772 1295256518\\r\\n', 'output': ['0 0']}, {'input': '625166755 843062051 1463070160 1958300154\\r\\n', 'output': ['0 0']}, {'input': '248228385 1458744978 824699604 1589655888\\r\\n', 'output': ['206174901 397413972']}, {'input': '186329049 1221011622 90104472 1769702163\\r\\n', 'output': ['60069648 1179801442']}, {'input': '511020182 242192314 394753578 198572007\\r\\n', 'output': ['394753578 198572007']}, {'input': '134081812 857875240 82707261 667398699\\r\\n', 'output': ['105411215 850606185']}, {'input': '721746595 799202881 143676564 380427290\\r\\n', 'output': ['287353128 760854580']}, {'input': '912724694 1268739154 440710604 387545692\\r\\n', 'output': ['881421208 775091384']}, {'input': '1103702793 1095784840 788679477 432619528\\r\\n', 'output': ['788679477 432619528']}, {'input': '548893795 861438648 131329677 177735812\\r\\n', 'output': ['525318708 710943248']}, {'input': '652586118 1793536161 127888702 397268645\\r\\n', 'output': ['511554808 1589074580']}, {'input': '756278440 578150025 96644319 26752094\\r\\n', 'output': ['676510233 187264658']}, {'input': '859970763 1510247537 37524734 97452508\\r\\n', 'output': ['562871010 1461787620']}, {'input': '547278097 1977241684 51768282 183174370\\r\\n', 'output': ['543566961 1923330885']}, {'input': '62256611 453071697 240966 206678\\r\\n', 'output': ['62169228 53322924']}, {'input': '1979767797 878430446 5812753 3794880\\r\\n', 'output': ['1342745943 876617280']}, {'input': '1143276347 1875662241 178868040 116042960\\r\\n', 'output': ['1140283755 739773870']}, {'input': '435954880 1740366589 19415065 185502270\\r\\n', 'output': ['182099920 1739883360']}, {'input': '664035593 983601098 4966148 2852768\\r\\n', 'output': ['664032908 381448928']}, {'input': '1461963719 350925487 135888396 83344296\\r\\n', 'output': ['572153868 350918568']}, {'input': '754199095 348965411 161206703 67014029\\r\\n', 'output': ['754119492 313489356']}, {'input': '166102153 494841162 14166516 76948872\\r\\n', 'output': ['91096406 494812252']}, {'input': '1243276346 1975662240 38441120 291740200\\r\\n', 'output': ['259477560 1969246350']}, {'input': '535954879 1840366588 26278959 73433046\\r\\n', 'output': ['535849118 1497358892']}, {'input': '764035592 1083601097 1192390 7267738\\r\\n', 'output': ['177777265 1083570463']}, {'input': '1561963718 450925486 475523188 136236856\\r\\n', 'output': ['1561914768 447486816']}, {'input': '854199094 448965410 364102983 125971431\\r\\n', 'output': ['853687785 295356745']}, {'input': '266102152 594841161 15854566 13392106\\r\\n', 'output': ['266043102 224722482']}, {'input': '1 1 2 1\\r\\n', 'output': ['0 0']}, {'input': '2000000000 2000000000 1 1999999999\\r\\n', 'output': ['1 1999999999']}, {'input': '2000000000 2000000000 1999999999 1\\r\\n', 'output': ['1999999999 1']}, {'input': '2000000000 2000000000 2 1999999999\\r\\n', 'output': ['2 1999999999']}, {'input': '1000000000 1000000000 999999999 2\\r\\n', 'output': ['999999999 2']}, {'input': '2000000000 2000000000 1999999999 2\\r\\n', 'output': ['1999999999 2']}, {'input': '2000000000 2000000000 1999999999 1999999998\\r\\n', 'output': ['1999999999 1999999998']}, {'input': '2000000000 2000000000 1999999998 1999999999\\r\\n', 'output': ['1999999998 1999999999']}, {'input': '1002105126 227379125 101440715 179460772\\r\\n', 'output': ['101440715 179460772']}, {'input': '18773663 74427904 186329049 1221011622\\r\\n', 'output': ['0 0']}, {'input': '912724694 21235685 356014460 15587143\\r\\n', 'output': ['356014460 15587143']}]","id":111} {"description":"The Hedgehog recently remembered one of his favorite childhood activities, \u2014 solving puzzles, and got into it with new vigor. He would sit day in, day out with his friend buried into thousands of tiny pieces of the picture, looking for the required items one by one.Soon the Hedgehog came up with a brilliant idea: instead of buying ready-made puzzles, one can take his own large piece of paper with some picture and cut it into many small rectangular pieces, then mix them and solve the resulting puzzle, trying to piece together the picture. The resulting task is even more challenging than the classic puzzle: now all the fragments have the same rectangular shape, and one can assemble the puzzle only relying on the picture drawn on the pieces.All puzzle pieces turn out to be of the same size X\u2009\u00d7\u2009Y, because the picture is cut first by horizontal cuts with the pitch of X, then with vertical cuts with the pitch of Y. If we denote the initial size of the picture as A\u2009\u00d7\u2009B, then A must be divisible by X and B must be divisible by Y (X and Y are integer numbers). However, not every such cutting of the picture will result in a good puzzle. The Hedgehog finds a puzzle good if no two pieces in it are the same (It is allowed to rotate the pieces when comparing them, but it is forbidden to turn them over). Your task is to count for a given picture the number of good puzzles that you can make from it, and also to find the puzzle with the minimal piece size.","input_specification":"The first line contains two numbers A and B which are the sizes of the picture. They are positive integers not exceeding 20. Then follow A lines containing B symbols each, describing the actual picture. The lines only contain uppercase English letters.","output_specification":"In the first line print the number of possible good puzzles (in other words, the number of pairs (X,\u2009Y) such that the puzzle with the corresponding element sizes will be good). This number should always be positive, because the whole picture is a good puzzle itself. In the second line print two numbers \u2014 the sizes X and Y of the smallest possible element among all good puzzles. The comparison is made firstly by the area XY of one element and secondly \u2014 by the length X.","notes":"NoteThe picture in the first sample test has the following good puzzles: (2,\u20091), (2,\u20092), (2,\u20094).","sample_inputs":["2 4\nABDC\nABDC","2 6\nABCCBA\nABCCBA"],"sample_outputs":["3\n2 1","1\n2 6"],"src_uid":"4de8b72f9ce12554cae8b6a83b3f023e","lang_cluster":"Java","difficulty":1800,"human_solution":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.PriorityQueue;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\/\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskB solver = new TaskB();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskB {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int A = in.nextInt();\n int B = in.nextInt();\n char[][] puzzle = new char[A][B];\n for (int i = 0; i < A; i++) {\n puzzle[i] = in.next().toCharArray();\n }\n PriorityQueue ans = new PriorityQueue<>();\n for (int Y = 1; Y <= A; Y++) {\n for (int X = 1; X <= B; X++) {\n if (A % Y == 0 && B % X == 0) {\n if (chk(puzzle, Y, X)) {\n ans.offer(new piece(Y, X));\n }\n }\n }\n }\n out.println(ans.size());\n out.println(ans.peek());\n }\n\n boolean chk(char[][] puzzle, int Y, int X) {\n ArrayList pieces = new ArrayList<>();\n for (int i = 0; i < puzzle.length; i += Y) {\n for (int j = 0; j < puzzle[0].length; j += X) {\n fullPiece next = new fullPiece(puzzle, Y, X, i, j);\n for (fullPiece cur : pieces) {\n if (next.eq(cur)) return false;\n }\n pieces.add(next);\n }\n }\n return true;\n }\n\n }\n\n static class piece implements Comparable {\n int y;\n int x;\n\n piece(int y1, int x1) {\n y = y1;\n x = x1;\n }\n\n public int compareTo(Object o) {\n piece other = (piece) o;\n int oS = other.x * other.y;\n int S = x * y;\n if (S == oS) {\n return y - other.y;\n }\n return S - oS;\n }\n\n public String toString() {\n return y + \" \" + x;\n }\n\n }\n\n static class InputReader {\n private BufferedReader reader;\n private StringTokenizer stt;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String nextLine() {\n try {\n return reader.readLine();\n } catch (IOException e) {\n return null;\n }\n }\n\n public String next() {\n while (stt == null || !stt.hasMoreTokens()) {\n stt = new StringTokenizer(nextLine());\n }\n return stt.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n }\n\n static class fullPiece {\n char[][] data;\n\n fullPiece(char[][] puzzle, int Y, int X, int top, int left) {\n data = new char[Y][X];\n for (int i = 0; i < Y; i++) {\n for (int j = 0; j < X; j++) {\n data[i][j] = puzzle[i + top][j + left];\n }\n }\n }\n\n public boolean eq(fullPiece other) {\n return eq0(other) || eq90(other) || eq180(other) || eq270(other);\n }\n\n private boolean eq0(fullPiece other) {\n int Y = data.length;\n int X = data[0].length;\n for (int i = 0; i < Y; i++) {\n for (int j = 0; j < X; j++) {\n if (data[i][j] != other.data[i][j]) return false;\n }\n }\n return true;\n }\n\n private boolean eq180(fullPiece other) {\n int Y = data.length;\n int X = data[0].length;\n for (int i = 0; i < Y; i++) {\n for (int j = 0; j < X; j++) {\n if (data[Y - i - 1][X - j - 1] != other.data[i][j]) return false;\n }\n }\n return true;\n }\n\n private boolean eq90(fullPiece other) {\n int Y = data.length;\n int X = data[0].length;\n if (other.data[0].length != Y) return false;\n if (other.data.length != X) return false;\n for (int i = 0; i < Y; i++) {\n for (int j = 0; j < X; j++) {\n if (data[X - j - 1][i] != other.data[i][j]) return false;\n }\n }\n return true;\n }\n\n private boolean eq270(fullPiece other) {\n int Y = data.length;\n int X = data[0].length;\n if (other.data[0].length != Y) return false;\n if (other.data.length != X) return false;\n for (int i = 0; i < Y; i++) {\n for (int j = 0; j < X; j++) {\n if (data[j][Y - i - 1] != other.data[i][j]) return false;\n }\n }\n return true;\n }\n\n }\n}\n\n","testcases":"[{'input': '2 4\\r\\nABDC\\r\\nABDC\\r\\n', 'output': ['3\\r\\n2 1\\r\\n']}, {'input': '2 6\\r\\nABCCBA\\r\\nABCCBA\\r\\n', 'output': ['1\\r\\n2 6\\r\\n']}, {'input': '2 2\\r\\nAB\\r\\nCD\\r\\n', 'output': ['4\\r\\n1 1\\r\\n']}, {'input': '4 6\\r\\nABABAC\\r\\nBABABC\\r\\nABABAC\\r\\nCCCCCA\\r\\n', 'output': ['4\\r\\n2 3\\r\\n']}, {'input': '1 12\\r\\nABAAADCAAABX\\r\\n', 'output': ['4\\r\\n1 3\\r\\n']}, {'input': '4 6\\r\\nABCDEF\\r\\nGHIJKL\\r\\nMNOPQR\\r\\nSTUVWX\\r\\n', 'output': ['12\\r\\n1 1\\r\\n']}, {'input': '5 5\\r\\nABAAA\\r\\nBBBAA\\r\\nABABA\\r\\nBBABB\\r\\nBAAAB\\r\\n', 'output': ['3\\r\\n1 5\\r\\n']}, {'input': '5 6\\r\\nBBBABB\\r\\nAAAABB\\r\\nABABAA\\r\\nABBBAA\\r\\nBABBBA\\r\\n', 'output': ['4\\r\\n1 6\\r\\n']}, {'input': '7 7\\r\\nBBAAABB\\r\\nAABBBBA\\r\\nAABABBA\\r\\nAABABAB\\r\\nAABBBAA\\r\\nBAAAABA\\r\\nBBABBBB\\r\\n', 'output': ['3\\r\\n1 7\\r\\n']}, {'input': '8 7\\r\\nBABABBB\\r\\nABABABA\\r\\nAABBABA\\r\\nABBABAA\\r\\nBABAAAB\\r\\nAABBBBA\\r\\nABBBBAB\\r\\nBBAAABA\\r\\n', 'output': ['5\\r\\n1 7\\r\\n']}, {'input': '8 9\\r\\nBAABABAAB\\r\\nBAABAAAAB\\r\\nBBBBBAABB\\r\\nAAAAAAAAB\\r\\nBABBABBAA\\r\\nBBABABBBB\\r\\nBABABBAAA\\r\\nAABAABBBB\\r\\n', 'output': ['7\\r\\n8 1\\r\\n']}, {'input': '10 10\\r\\nABBAABAABB\\r\\nABAAAAAABA\\r\\nBAABABABAA\\r\\nBAAAAAAAAB\\r\\nBABABBBAAB\\r\\nABBABBBBBA\\r\\nAABABAAAAA\\r\\nBAAAABAABA\\r\\nABABAABBAA\\r\\nBBABBABABB\\r\\n', 'output': ['9\\r\\n1 10\\r\\n']}, {'input': '10 11\\r\\nABBBAABABBB\\r\\nBBAABABBAAB\\r\\nAABBBBBAAAA\\r\\nBBABABAAABA\\r\\nAABABBBAABB\\r\\nAAABABAABAB\\r\\nBBABBBABBBB\\r\\nBBABABABBAA\\r\\nBBABABAAABB\\r\\nBABAABAABAB\\r\\n', 'output': ['5\\r\\n10 1\\r\\n']}, {'input': '12 11\\r\\nBBAAAABBAAB\\r\\nBBABBABBABB\\r\\nBAABABBABBA\\r\\nBABBBAAAABA\\r\\nABBAABBBBBA\\r\\nABBABBABABB\\r\\nAAABBBABBBB\\r\\nBAABAAABAAA\\r\\nAAAABBBBABA\\r\\nAAABAAABBBB\\r\\nBAAAAABABAB\\r\\nABBBBABABBB\\r\\n', 'output': ['7\\r\\n1 11\\r\\n']}, {'input': '12 13\\r\\nBBABABAAAAABA\\r\\nABAAAAAAAABBA\\r\\nABBBABAAAAABA\\r\\nBBBAABABBABBB\\r\\nABABAAABABABB\\r\\nABBAABAABBAAA\\r\\nAABABBAAABBAB\\r\\nABBBBBABBAABA\\r\\nBBBBBABBABBAA\\r\\nAAAAAAABBBAAB\\r\\nBAABBBAABAAAA\\r\\nBBBBBBABABABA\\r\\n', 'output': ['7\\r\\n12 1\\r\\n']}, {'input': '14 12\\r\\nBBAAABBBAAAB\\r\\nBBABAAAAABAA\\r\\nAABBABBBABBA\\r\\nBABAABAABBBB\\r\\nBBBABBBBABAA\\r\\nABBAABBAAABA\\r\\nABAAAAABBBAB\\r\\nBBAABBABBBAA\\r\\nBAABABAAABAB\\r\\nAAABBBABBABA\\r\\nBABBBBAABBBA\\r\\nAAAAABABBAAB\\r\\nBABBBABBBBBA\\r\\nBAAAABAABAAA\\r\\n', 'output': ['14\\r\\n1 12\\r\\n']}, {'input': '14 10\\r\\nABBAAABBAA\\r\\nBBBBBABBAA\\r\\nBABABBABAB\\r\\nAAABABBAAB\\r\\nBBABABBBAB\\r\\nBBABBABABB\\r\\nAABBBBABAA\\r\\nABBBAAAABB\\r\\nABBABAABAA\\r\\nABABABABBA\\r\\nABAABBBAAB\\r\\nAAAAAAAAAA\\r\\nABABBAABAA\\r\\nBABAABABBB\\r\\n', 'output': ['10\\r\\n1 10\\r\\n']}, {'input': '16 15\\r\\nABBBBAAABABBABB\\r\\nABBBAAABBABBBBB\\r\\nBABABAABBBABABB\\r\\nAAABBBBBABBABBB\\r\\nBAABAABAABAABBA\\r\\nABBBBAAAAAAAABB\\r\\nBAABBBABABAAAAB\\r\\nAAAABBAABBAABAA\\r\\nABBABABAAABABBB\\r\\nAAABBBABAABABAA\\r\\nBAABABBAAABBAAA\\r\\nAAAAAAABABBBAAA\\r\\nBABBAABBABAAAAB\\r\\nABABAAABBBBBAAB\\r\\nBBABBAABABAABBB\\r\\nBAAAABBBABABBBA\\r\\n', 'output': ['12\\r\\n4 3\\r\\n']}, {'input': '16 16\\r\\nABBABBABBAABBBAB\\r\\nBABABBAABAABBAAA\\r\\nBAAABBAABAABBBAA\\r\\nAABAAAABAAAABBBA\\r\\nBAAAABAABBBABBAA\\r\\nAABBABABABAABBBA\\r\\nBABBBABAAAAABABB\\r\\nBABBBBBBBBABBBAB\\r\\nBAAAABBBABAABBBA\\r\\nBABBBABBAABABBAA\\r\\nBBBBBBAABBBABBBA\\r\\nBABAAAABAABAABBB\\r\\nAAAAABBAAABABAAA\\r\\nBABBABABABAAABAB\\r\\nBAAAAAAAABBABAAA\\r\\nBAAAAABABBBBAAAA\\r\\n', 'output': ['15\\r\\n1 16\\r\\n']}, {'input': '18 18\\r\\nBBBBBBBABABBBABABA\\r\\nBAAABAAABBBABABBBB\\r\\nBABBAAABAAABAAABAA\\r\\nAABBABBBABBBBBAAAB\\r\\nBBBAAAAABBABBAAAAA\\r\\nAABBAABABABBBABABA\\r\\nBAABBAAAABABAABABB\\r\\nBABBABBBAAAABAABBA\\r\\nBBBBAABAAABAAABBBA\\r\\nABABBAAABBBBBABABA\\r\\nABABAABBBBBABBBBBB\\r\\nABAAABBABBABAAAABA\\r\\nBABAAABABABBBABBBB\\r\\nBBBBABBBABBBBBBBBA\\r\\nBAAABAABABABBBBAAB\\r\\nBABBAABABBABAABBBB\\r\\nBAABABAAAABBABBAAA\\r\\nBAAABBBAABABBABBAB\\r\\n', 'output': ['23\\r\\n2 6\\r\\n']}, {'input': '17 17\\r\\nBBAABAABBBBBAABBB\\r\\nBBABABBBBABAAABBB\\r\\nAAAABAAAABABABBAA\\r\\nBBABAAABBABBAAABA\\r\\nAAABBBBBAABABBBAB\\r\\nAABBBBBABABABABBB\\r\\nBAABAAABAAABBAABB\\r\\nBBAAAAAABABABBAAB\\r\\nAAAAABAABBAAAABAA\\r\\nBABAABABABABABBBB\\r\\nBAABABBAAABBAAABB\\r\\nABBAAABBBBAAAABAB\\r\\nBBABAABAAAAAABBBB\\r\\nAAABBABBAAAAABBBB\\r\\nAABAABBAABBABAABB\\r\\nABABAAABBABAAABAB\\r\\nBBABABBBAAAAAAABA\\r\\n', 'output': ['3\\r\\n1 17\\r\\n']}, {'input': '20 20\\r\\nABBBAAABABAAAAABBABB\\r\\nBABABBAABAABBAAABABB\\r\\nBABBBAABAABBABBBBABA\\r\\nBAAABBAAABABBABBAAAA\\r\\nABBAABAABBBBAAABBBAA\\r\\nBAAAAAAAABABBAAAAABB\\r\\nAAAAAAABABBBBBAABAAB\\r\\nABBBBABAABBAAAAABAAA\\r\\nBAAAAABBABAAAAABAAAB\\r\\nABABAABABBBABBAABBAA\\r\\nBAAABBBAAAABBBBBABAA\\r\\nAAABBABABAABBABAABAB\\r\\nABBABABABABAAABABABA\\r\\nBAABAAAAABBAABBBAAAB\\r\\nABAAABBABAABBBABAABA\\r\\nBAABBBBBABBBABBBABAB\\r\\nBABBABABBBBBBBBABAAA\\r\\nABAAABAAABAAABABABAA\\r\\nBAABBBBAABBAAAAAABBA\\r\\nABAABBABAAABBABABAAA\\r\\n', 'output': ['23\\r\\n1 10\\r\\n']}, {'input': '1 1\\r\\nC\\r\\n', 'output': ['1\\r\\n1 1\\r\\n']}, {'input': '2 2\\r\\nCC\\r\\nBB\\r\\n', 'output': ['2\\r\\n1 2\\r\\n']}, {'input': '3 3\\r\\nACA\\r\\nCCA\\r\\nACB\\r\\n', 'output': ['3\\r\\n1 3\\r\\n']}, {'input': '4 4\\r\\nACAC\\r\\nCBCC\\r\\nABBC\\r\\nCCAC\\r\\n', 'output': ['5\\r\\n1 4\\r\\n']}, {'input': '5 5\\r\\nBBCAB\\r\\nBCBAC\\r\\nCAAAB\\r\\nACBBA\\r\\nCAACB\\r\\n', 'output': ['3\\r\\n1 5\\r\\n']}, {'input': '14 16\\r\\nCBCCCABCBBBAAACC\\r\\nAABAACBACBCBACCA\\r\\nABBBABAACCACCCCC\\r\\nBBACACACCCCBBBAC\\r\\nBBCAABACBAACBCAA\\r\\nAAACCACBBCABABCB\\r\\nABCBCAAAAACBABBA\\r\\nAAABBBCCBAACBBCA\\r\\nBBAACBABBBCCBAAC\\r\\nBAABCCBAAABAACAC\\r\\nABBBBCBAACACCBCB\\r\\nBCABACBBBCAACACC\\r\\nACCCCABCCCBBCAAC\\r\\nBCBBCCCBCBCCACAA\\r\\n', 'output': ['15\\r\\n7 1\\r\\n']}, {'input': '16 16\\r\\nACABBCCBAABCCCCB\\r\\nAABCACCAAACACABB\\r\\nBCCCAABBAACBACAA\\r\\nBCACAABBBCAAAABA\\r\\nACCBABCCACABBCCC\\r\\nCCAAACACACBCABCA\\r\\nBCAACBBBCACBBCAB\\r\\nBABBCBBBCCCBAACC\\r\\nBBBBBABACBABBCBA\\r\\nABAACBACCACBBABA\\r\\nABAACBACCBCBCCBB\\r\\nBCACCCAABCBBCBCB\\r\\nBBBCCCBCCBCBACCA\\r\\nAABCBBBBACCACCBB\\r\\nBCABCCCBCBBBCBCC\\r\\nACCCCCCBBBAABACC\\r\\n', 'output': ['17\\r\\n4 2\\r\\n']}, {'input': '17 17\\r\\nBCBAAABAABCCCAAAC\\r\\nBBAABCABBAACCACBB\\r\\nABCCBAABBCCABBBAB\\r\\nAACCBBACCAAACCACA\\r\\nABBACBAAAABBABCAA\\r\\nACBACCCABAABBCABB\\r\\nCBCCCBCACBABCAAAA\\r\\nAAABACACABABCCCBC\\r\\nCABABBABBBABBBCAB\\r\\nBCBCBAAACCCACACBA\\r\\nBBACABACAAABCCBBC\\r\\nABAABBABCCAABBCCA\\r\\nAABBACBCBCCBAACBB\\r\\nBBABCBBCCCBCACBCB\\r\\nBABCBBCCABCABBAAA\\r\\nAABAABBBBAACAABCC\\r\\nBACCCBBCCABBBACBB\\r\\n', 'output': ['3\\r\\n1 17\\r\\n']}, {'input': '19 19\\r\\nACCACBCABACABCACCAA\\r\\nBCACAAAACCACCCCBCCB\\r\\nCBACBBCBCBCABCABACA\\r\\nAACCAABBBCAAABACAAC\\r\\nACACCCBBBACACCAAABA\\r\\nAACAABCACCBCACCABBA\\r\\nAABBCCABACCACABACAA\\r\\nACBCCACBACCACABCABC\\r\\nAACAABCAACCBBAACBCA\\r\\nAAACACBAABCBACCAAAB\\r\\nAABACABBABCACAACBCA\\r\\nBABAAABCACBABACBBBC\\r\\nBAABCAAABCAABBCCAAC\\r\\nBCABCCBCCBCBABCBCCA\\r\\nBACACBACBCABBCBCABB\\r\\nABCACCBBBBCBBCABAAC\\r\\nBBBBCCBCBACAACBCBCA\\r\\nAAABBBBCACCACCAAACC\\r\\nCCCCCBAABAAAACCCBBA\\r\\n', 'output': ['3\\r\\n1 19\\r\\n']}, {'input': '20 18\\r\\nAABCAACCBBCBABBBBB\\r\\nBBCBAACCBCAACBBCCB\\r\\nACCBABABACBBACBBAB\\r\\nACBBBCBAAACAAAAABB\\r\\nBCBABABAACCCABBBCC\\r\\nBAAAAAACACABBCCCAC\\r\\nCBACCBCBACACAAACBC\\r\\nCBACAACBCBCAACACCA\\r\\nCCCBACCBACACCCBCCB\\r\\nCACABBBBBBCCBACCBA\\r\\nCCBCACABCBACABBCCB\\r\\nAACACCCCCABAABCACC\\r\\nCBBACCBBCBCBBCCAAB\\r\\nCABBABACCABACAABAB\\r\\nBBBABBCBCBACBCCABA\\r\\nBCCAACBCBCAAAABACA\\r\\nAAABACBBCCCACACBAC\\r\\nBABAAAACCBACBACAAA\\r\\nAABBABCBBBACAACBAB\\r\\nBBABBAABACBAABCCBB\\r\\n', 'output': ['27\\r\\n4 2\\r\\n']}, {'input': '1 1\\r\\nZ\\r\\n', 'output': ['1\\r\\n1 1\\r\\n']}, {'input': '2 2\\r\\nML\\r\\nWQ\\r\\n', 'output': ['4\\r\\n1 1\\r\\n']}, {'input': '3 3\\r\\nBXP\\r\\nUJF\\r\\nAQT\\r\\n', 'output': ['4\\r\\n1 1\\r\\n']}, {'input': '4 3\\r\\nOKJ\\r\\nXTV\\r\\nDVW\\r\\nHMK\\r\\n', 'output': ['5\\r\\n2 1\\r\\n']}, {'input': '5 5\\r\\nDZEZF\\r\\nOHZZC\\r\\nCNDOX\\r\\nNVYDP\\r\\nUCIAX\\r\\n', 'output': ['3\\r\\n1 5\\r\\n']}, {'input': '6 6\\r\\nQLXBOE\\r\\nKEEYTR\\r\\nZLPMSP\\r\\nWOKAHN\\r\\nLYXBXU\\r\\nSZOEZV\\r\\n', 'output': ['14\\r\\n2 1\\r\\n']}, {'input': '6 7\\r\\nGYSGYUL\\r\\nKGTJUVI\\r\\nFNRHOND\\r\\nZGZAFYZ\\r\\nQVCRZCA\\r\\nJCCXKGV\\r\\n', 'output': ['7\\r\\n2 1\\r\\n']}, {'input': '8 8\\r\\nTNMIIMOP\\r\\nJOAXSHVN\\r\\nQYHMVXGM\\r\\nQOXAIUMI\\r\\nLAAXNKCH\\r\\nORWESZUV\\r\\nPMIXHLEA\\r\\nAENPGVYK\\r\\n', 'output': ['13\\r\\n1 4\\r\\n']}, {'input': '9 9\\r\\nIZHKRCRTM\\r\\nLQBOENMNQ\\r\\nYLNVFBFUY\\r\\nACTTYWABL\\r\\nYSEGWNQHC\\r\\nTZASWPPAG\\r\\nLLZTKFPMV\\r\\nGXBETPPPN\\r\\nUCPEFNJKN\\r\\n', 'output': ['8\\r\\n1 3\\r\\n']}, {'input': '9 10\\r\\nXHPCDAAFPZ\\r\\nJRZCDTQBYP\\r\\nZBTAMDPIFY\\r\\nXBKTMXNIWM\\r\\nDAIONPEBYF\\r\\nAFHBCBDTKB\\r\\nKRVEBSUXRM\\r\\nWGMEZTWDBX\\r\\nNOJUCDZPZY\\r\\n', 'output': ['10\\r\\n3 1\\r\\n']}, {'input': '12 13\\r\\nTHSGJEPTDFEIJ\\r\\nOWPJGXSXJRYGD\\r\\nVYENWXFWSOSMX\\r\\nFZDFXFPWEIYYV\\r\\nOEODFOGQWJEEU\\r\\nSQRNSBTAMLQRU\\r\\nLXGZERSWTJWQK\\r\\nLGRJJMDTZVZWJ\\r\\nDWVBTSZKFUAHT\\r\\nHSSZHXAWVWMHB\\r\\nJZOCNFUHTHQYV\\r\\nTUHDMTZAQVWDL\\r\\n', 'output': ['10\\r\\n3 1\\r\\n']}, {'input': '14 13\\r\\nBGBALYLHQYMFM\\r\\nRLFOZFDFMRFEN\\r\\nGDWROOMXUVBOW\\r\\nDPXWRDPCEFMRQ\\r\\nJOSEGKGMHGHFC\\r\\nJHXUBTPOZOYGJ\\r\\nFHUUMHWSQRNEP\\r\\nVGWYMTMWHWGIL\\r\\nVMWDTBDJGEVZI\\r\\nLEJSIHTQKYDXY\\r\\nOLUOIWECMZVAI\\r\\nVDXSGRPMCCJEM\\r\\nMYWMDDAQAPBSG\\r\\nXQWPFRAPVEOYO\\r\\n', 'output': ['6\\r\\n7 1\\r\\n']}, {'input': '14 15\\r\\nJFLSOQHVDRTCPWZ\\r\\nWSROLOOQOCWPJNX\\r\\nEEUZVBLQXBFQKNA\\r\\nQIGZDIMDXVCHJFJ\\r\\nUDJGIZWDBMMMBJR\\r\\nEWXAQHPRYBQOYDT\\r\\nUDEAPOBVZOXNVMK\\r\\nAYEVKFIKNRUVRQC\\r\\nNLTLJBXWMUQXAZD\\r\\nKOXESBBUYLMIDOI\\r\\nZOJWEOJFCYTILHE\\r\\nRQDNTBZZXPKNCEN\\r\\nSYGFASAQUSMYYRP\\r\\nUOYCFYUDACJDTAD\\r\\n', 'output': ['13\\r\\n1 5\\r\\n']}, {'input': '16 15\\r\\nPFUMRKDISIBBVYP\\r\\nMZKXWWSQXADAPEB\\r\\nVTBYXGWQYZTHBHY\\r\\nONGURZKWHZDKIDF\\r\\nGCMHQQNJJXHHPVU\\r\\nNLMUXXKZOFNMFTG\\r\\nANDDDPHEDVWVHLC\\r\\nOYGXUHIMYPNIXCT\\r\\nILCGDQZNCSTIILX\\r\\nZVSYMJBHAUEXZMY\\r\\nMYOKFPJKKJLKVWI\\r\\nUEMUOOAJSNTOLEN\\r\\nLKIROZUNWRZBMZP\\r\\nYYWCXLGHLZQVPOB\\r\\nFMHPKABCBAAYCFA\\r\\nNRGFEWPLKNORSZR\\r\\n', 'output': ['18\\r\\n1 3\\r\\n']}, {'input': '14 17\\r\\nXGFETCAWEBHYYDECE\\r\\nCGFEUQEYMLSVHNKJA\\r\\nZMGSXZJASBUPTHRFQ\\r\\nGQREDKHDBTZPGWHEO\\r\\nQGACDHZVBAOGLHHEL\\r\\nLKLKVFVDHSRQNEDXC\\r\\nVNREYHZDJHPJKHXDO\\r\\nKBOMZYHZEUOYUOXSQ\\r\\nFNQGOBVDBTMUJPAKU\\r\\nXFPGQQXBPELKWSXCJ\\r\\nABUKLBPTFOGUJFDEQ\\r\\nKXPJEZJQCHTENYSKY\\r\\nXXOKEXESEVLQMFDZG\\r\\nVPGUBSJLGBWZWAMFZ\\r\\n', 'output': ['6\\r\\n7 1\\r\\n']}, {'input': '16 17\\r\\nFFOYWWWJRUPVBGSSJ\\r\\nVPOMWQMWUWYMMDAPB\\r\\nARQUYXZTHVSQZHMVJ\\r\\nCJAGELECYEXSHEYTU\\r\\nXRSZPRCBQPJQACNWR\\r\\nJISALKDCKJUWWHMYH\\r\\nGMISALZMLGRRGALJA\\r\\nCWPYTQYBXKLBGWKNF\\r\\nMJJYWBIHJLARHFNWB\\r\\nKEREXXISTPANXGGJG\\r\\nLECEJLPAFOZHLRTJM\\r\\nHBOWFNSQFRRGEJFMJ\\r\\nVEGIRVEXACMJVKFYN\\r\\nSCGOPQKUHEDNIPIRE\\r\\nLENRPPYJBEVDTOPOY\\r\\nFHJOESUHLIJRFPVBK\\r\\n', 'output': ['8\\r\\n4 1\\r\\n']}, {'input': '18 19\\r\\nLEXQWPUXGOWSELHIQPY\\r\\nZUYPTUDHEEQVRWBCXBU\\r\\nZUPMYQQQFHGKZZDMLFM\\r\\nCASSUVIKQKCEALUDDFK\\r\\nFDBZOXULVGFARYPNAQY\\r\\nWEFLTZOSOAGAMBWNGVC\\r\\nEVAPNTSSIMKNBOAHFSC\\r\\nUHTWEBRCEUJSARNEWYI\\r\\nGXGSDCDUIWYQRZUPQBZ\\r\\nFMYJUOHENURMDINJGCN\\r\\nHIBATJCOGWWRQWTLXDH\\r\\nRDDXJNZHQGUWPNGIDRO\\r\\nAJGHDUCGGLPYYDYSFRS\\r\\nAZGBVLJYYZWSQGBFJVU\\r\\nQJJRSHZFOECHGRGALML\\r\\nJKDMLPREFTISSSAJKJN\\r\\nGRHGVYSVQLYKCIMBIKA\\r\\nMSHRBZJJLDHBCAWAJBN\\r\\n', 'output': ['10\\r\\n3 1\\r\\n']}, {'input': '20 18\\r\\nNLBILWYVJJLCACSMUA\\r\\nAAMAWVGEZDTWUUZNMM\\r\\nWWNOTPPFXJSWWSPPRB\\r\\nYUJXZSHHNFGKXIXEJN\\r\\nLTKNJOJALEQURSYVBI\\r\\nSVXHFTUYWTLBXWFDXD\\r\\nLQUEBPXELRNAXFIKFT\\r\\nZGZEPWGVLVNMQVRMJM\\r\\nWTMIPWRNQCWKZACSKQ\\r\\nYGUREEGHTVMICOCUHE\\r\\nUNIJGNPINIFWCIHGIQ\\r\\nIRGJEHFRUJOHIXRSLF\\r\\nDQVCPHUSKYEHFGWBPS\\r\\nJIIGNJKTRAAPRBOGMQ\\r\\nHFNGDLVBUVECUMQDMT\\r\\nGEGCSOPRXQAEMDQAYO\\r\\nOHSBTADOWBVKZINKXC\\r\\nIIPWCAZSNDFVBMTGMI\\r\\nOZZTLUOFRYDNTPIAVA\\r\\nTFBGPAMJPIWLEZOKXB\\r\\n', 'output': ['33\\r\\n1 3\\r\\n']}, {'input': '2 4\\r\\nABAA\\r\\nABBB\\r\\n', 'output': ['2\\r\\n1 4\\r\\n']}, {'input': '6 6\\r\\nCCABCA\\r\\nBCBCBC\\r\\nBAAAAA\\r\\nCBBCAA\\r\\nACBBCA\\r\\nCCAABA\\r\\n', 'output': ['10\\r\\n1 6\\r\\n']}, {'input': '16 4\\r\\nBAAC\\r\\nBACA\\r\\nACBC\\r\\nABCC\\r\\nCCAC\\r\\nBBCC\\r\\nCCAB\\r\\nABCC\\r\\nCBCA\\r\\nBCBC\\r\\nBCBC\\r\\nCBBB\\r\\nBBAA\\r\\nBACA\\r\\nABCB\\r\\nAABA\\r\\n', 'output': ['9\\r\\n2 4\\r\\n']}, {'input': '2 14\\r\\nAABACBACBCBBCB\\r\\nBACCBBBCBAABBC\\r\\n', 'output': ['4\\r\\n1 7\\r\\n']}, {'input': '4 8\\r\\nCACABCCA\\r\\nABCBAACA\\r\\nACABBBCC\\r\\nAACCBCBB\\r\\n', 'output': ['8\\r\\n1 4\\r\\n']}, {'input': '12 18\\r\\nCBBCAACABACCACABBC\\r\\nABCAACABAABCBCBCCC\\r\\nBCAACCCBBBABBACBBA\\r\\nACCBCBBBAABACCACCC\\r\\nCAABCCCACACCBACACC\\r\\nBBBCBCACCABCCBCBBB\\r\\nBAABBCACAAAAACCBCB\\r\\nBAABAABACBCABACBCA\\r\\nAABCBCCBCCABACCCAC\\r\\nCCBBBAACCCBCACCCBB\\r\\nCBABACBBBABCBACCCB\\r\\nAABACCCBCCACBCACCB\\r\\n', 'output': ['24\\r\\n4 2\\r\\n']}]","id":112} {"description":"Having unraveled the Berland Dictionary, the scientists managed to read the notes of the chroniclers of that time. For example, they learned how the chief of the ancient Berland tribe was chosen.As soon as enough pretenders was picked, the following test took place among them: the chief of the tribe took a slab divided by horizontal and vertical stripes into identical squares (the slab consisted of N lines and M columns) and painted every square black or white. Then every pretender was given a slab of the same size but painted entirely white. Within a day a pretender could paint any side-linked set of the squares of the slab some color. The set is called linked if for any two squares belonging to the set there is a path belonging the set on which any two neighboring squares share a side. The aim of each pretender is to paint his slab in the exactly the same way as the chief\u2019s slab is painted. The one who paints a slab like that first becomes the new chief.Scientists found the slab painted by the ancient Berland tribe chief. Help them to determine the minimal amount of days needed to find a new chief if he had to paint his slab in the given way.","input_specification":"The first line contains two integers N and M (1\u2009\u2264\u2009N,\u2009M\u2009\u2264\u200950) \u2014 the number of lines and columns on the slab. The next N lines contain M symbols each \u2014 the final coloration of the slab. W stands for the square that should be painted white and B \u2014 for the square that should be painted black.","output_specification":"In the single line output the minimal number of repaintings of side-linked areas needed to get the required coloration of the slab.","notes":null,"sample_inputs":["3 3\nWBW\nBWB\nWBW","2 3\nBBB\nBWB"],"sample_outputs":["2","1"],"src_uid":"73291724a4609ddd4cc8a92c77e8496f","lang_cluster":"Java","difficulty":2600,"human_solution":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Queue;\nimport java.util.ArrayDeque;\nimport java.util.Collections;\nimport java.io.InputStream;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\/\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n TaskE solver = new TaskE();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class TaskE {\n final int INF = 0x3f3f3f3f;\n String[] matrix;\n int[][] zoneIndex;\n int zones;\n int[] dx = new int[]{-1, 0, 1, 0};\n int[] dy = new int[]{0, 1, 0, -1};\n int blackNodes;\n List[] graph;\n\n @SuppressWarnings(\"unchecked\")\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt(), m = in.nextInt();\n matrix = new String[n];\n for (int i = 0; i < n; ++i)\n matrix[i] = in.next();\n\n zoneIndex = new int[n][m];\n for (int[] p : zoneIndex) Arrays.fill(p, -1);\n zones = 0;\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n if (matrix[i].charAt(j) == 'B' && zoneIndex[i][j] == -1) {\n dfs(i, j);\n zones++;\n }\n }\n }\n blackNodes = zones;\n if (zones <= 1) {\n out.println(zones);\n return;\n }\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n if (matrix[i].charAt(j) == 'W' && zoneIndex[i][j] == -1) {\n dfs(i, j);\n zones++;\n }\n }\n }\n\n graph = new List[zones];\n for (int i = 0; i < zones; ++i)\n graph[i] = new ArrayList<>();\n for (int i = 0; i < n; ++i) {\n for (int j = 0; j < m; ++j) {\n getEdges(i, j);\n }\n }\n for (int i = 0; i < zones; ++i) {\n Collections.sort(graph[i]);\n List adj = new ArrayList<>();\n int prev = -1;\n for (int p : graph[i]) {\n if (p != prev) {\n adj.add(p);\n prev = p;\n }\n }\n graph[i] = adj;\n }\n\n Queue q = new ArrayDeque<>();\n int ans = INF;\n for (int i = 0; i < zones; ++i) {\n int[] dist = new int[zones];\n dist[i] = 1;\n q.add(i);\n int mdist = 1;\n while (!q.isEmpty()) {\n int node = q.poll();\n mdist = dist[node];\n for (int p : graph[node]) {\n if (dist[p] == 0) {\n dist[p] = dist[node] + 1;\n q.add(p);\n }\n }\n }\n if (i >= blackNodes) mdist &= ~1;\n else mdist -= (mdist & 1) ^ 1;\n ans = Math.min(ans, mdist);\n }\n\n out.println(ans);\n }\n\n private void dfs(int x, int y) {\n zoneIndex[x][y] = zones;\n for (int k = 0; k < 4; ++k) {\n int nx = x + dx[k], ny = y + dy[k];\n if (0 <= nx && nx < matrix.length &&\n 0 <= ny && ny < matrix[0].length() &&\n matrix[x].charAt(y) == matrix[nx].charAt(ny) &&\n zoneIndex[nx][ny] == -1) {\n dfs(nx, ny);\n }\n }\n }\n\n private void getEdges(int x, int y) {\n int node = zoneIndex[x][y];\n for (int k = 0; k < 4; ++k) {\n int nx = x + dx[k], ny = y + dy[k];\n if (!(0 <= nx && nx < matrix.length &&\n 0 <= ny && ny < matrix[0].length())) continue;\n int p = zoneIndex[nx][ny];\n if (p != node) {\n graph[node].add(p);\n }\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1)\n throw new UnknownError();\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new UnknownError();\n }\n if (numChars <= 0)\n return -1;\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public String next() {\n int c = read();\n while (isSpaceChar(c))\n c = read();\n StringBuffer res = new StringBuffer();\n do {\n res.appendCodePoint(c);\n c = read();\n } while (!isSpaceChar(c));\n\n return res.toString();\n }\n\n private boolean isSpaceChar(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n }\n}\n\n","testcases":"[{'input': '3 3\\r\\nWBW\\r\\nBWB\\r\\nWBW\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 3\\r\\nBBB\\r\\nBWB\\r\\n', 'output': ['1\\r\\n']}, {'input': '9 29\\r\\nBWBBBBBBBBBWBWWBBBWBWBBBWWBWW\\r\\nWBWBBWBBWBWWBWBBBWBWWWBWBBBBB\\r\\nBWBBBBWWBBBWBWBBWWBBWBBBBBBBB\\r\\nBBBWWBBWWBBBWBWBBBWWWWWWBBBBW\\r\\nBBWWWWBBBBBBBBBWBBBBBBBBBBWBW\\r\\nBBBWWBBBBWBBBWWBBBWBBBBWBBWBW\\r\\nBBBBBWBWBBBWWBBWBBBBBBBBBBBBW\\r\\nWWBBBWWBWBWBBBBWBBBBWWWBBBBBB\\r\\nBWWBWBBBBBWBBWBBBBBBBWBWBBBWW\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 5\\r\\nBBBBB\\r\\nBWWBB\\r\\nWWBBB\\r\\n', 'output': ['1\\r\\n']}, {'input': '17 22\\r\\nBBWBBWWWBBWWWBBBBBBWWW\\r\\nWWBWBWWBBWBBBWWBBBBBWW\\r\\nBBBWBWBBWBWBWBWWBWWBBB\\r\\nBWBBBBWBBBWBWBBBBBWBWW\\r\\nBBWWWWWBBBBBWBWBBBBBBB\\r\\nBBBWBBWWWWBBWWBWBWWBBW\\r\\nBBBWWWWWWWBWWWBBBWWWWW\\r\\nBBBBWBBBWBWBBWBBBWWWBB\\r\\nBWWWWBBBWWWBBBBBBWBWWW\\r\\nBBBBWBWBWBWBBBWWBWBBBB\\r\\nBBWBWWBWWWBWBWWBWBBBBW\\r\\nWWBWWBBBBWBWBWBWWBBBBB\\r\\nWWWWBWBBBWBBBWWBBWWBBW\\r\\nBBBBBWWBBBBWWWWBWBBBWW\\r\\nBBBBBWBBWBWBBWBWWBBBBW\\r\\nWWBBBWBWBBWWWBBBWWBBBW\\r\\nWWBWBBBBWBBBWBBBWBBBBB\\r\\n', 'output': ['4\\r\\n']}, {'input': '23 12\\r\\nBWWWBBWWWWWW\\r\\nWWWWBWWWBWWW\\r\\nBWBWWWWBBWWB\\r\\nWBWWWWBWWBWW\\r\\nBWWWWWWWWWWW\\r\\nWWWWWWBWWWWW\\r\\nWWWWWBWBWWBB\\r\\nWBBWWWWWWWWW\\r\\nWWBWBBWWWBBW\\r\\nWWWWWWWWWWWW\\r\\nWWWWWWWWWWWW\\r\\nWWWWWWBWWWWW\\r\\nBWWWWBBWBWWB\\r\\nBWBWWWWWWBWW\\r\\nWWWWWWWBWWWW\\r\\nWWBBWWWBWWBW\\r\\nBBWBWBWWWWWW\\r\\nWWBWBBWWWBBW\\r\\nWBWWWWWBWWBW\\r\\nWWWWBBBWWWWW\\r\\nWWWWBWWBBWWW\\r\\nWWWBBWWWWWWW\\r\\nWWWBWWBWWWBW\\r\\n', 'output': ['2\\r\\n']}, {'input': '41 6\\r\\nWBBBWB\\r\\nWWBWBW\\r\\nBBBBWB\\r\\nBBWBBB\\r\\nBBBWWW\\r\\nBBBWBB\\r\\nBBWBBB\\r\\nBBWWBB\\r\\nWBBBBB\\r\\nWBBBBB\\r\\nBBBBBB\\r\\nBBBBBB\\r\\nBBBBBB\\r\\nBBBBBB\\r\\nBBBBBB\\r\\nBBBBBB\\r\\nWBBBBB\\r\\nBBBBBW\\r\\nBWBWBW\\r\\nBBBBBB\\r\\nWWWBWW\\r\\nBBBBBB\\r\\nWBBBWB\\r\\nBBBWBB\\r\\nBBWBBB\\r\\nBWBWBB\\r\\nBWBBBB\\r\\nWBWBBB\\r\\nBBWWBB\\r\\nBBBBBB\\r\\nBBBBBB\\r\\nBBBBWB\\r\\nBBBBBB\\r\\nBBBBBW\\r\\nBWBWBW\\r\\nBBBBWB\\r\\nWBBWBB\\r\\nWBWBBW\\r\\nBBWBWW\\r\\nBBBWWB\\r\\nBBWWBB\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 7\\r\\nBBBBBBB\\r\\nBBBBBBB\\r\\n', 'output': ['1\\r\\n']}, {'input': '7 28\\r\\nWWWWWWWWWBBWWWBBWBWWBWWBWWWW\\r\\nWWBBBWWWWWWWBWBBBWWWWBBWBWBW\\r\\nBWWWBBWWBWBWWBWWWWWWBBWWWWWW\\r\\nWBWWWWWWWBBBBWBBWWWWWWWBWWBB\\r\\nWWWBWBWWWWWBBWBWWWWBWWBWWBWW\\r\\nWWBWWWBWWWBWWBBWBWWWWWWBWWWB\\r\\nBWWWWBWWWWWWWWWBWBWWBWWWWWWW\\r\\n', 'output': ['3\\r\\n']}, {'input': '25 6\\r\\nWWWWWB\\r\\nWWBBWW\\r\\nBWBWWB\\r\\nBBWWWW\\r\\nBWWWWW\\r\\nWWWWWW\\r\\nWWWWWW\\r\\nWWWBWW\\r\\nWBWWWW\\r\\nWWWWWW\\r\\nWWBWWW\\r\\nWWWWWW\\r\\nWWBWWW\\r\\nWWWWWW\\r\\nWWWBWW\\r\\nWWWBWW\\r\\nWWWBWB\\r\\nWWWWWW\\r\\nWWWWWW\\r\\nWBWWWB\\r\\nBWWWWW\\r\\nBWBWWB\\r\\nWBWWWB\\r\\nWWWBWB\\r\\nWWWWBW\\r\\n', 'output': ['2\\r\\n']}, {'input': '42 1\\r\\nW\\r\\nW\\r\\nW\\r\\nB\\r\\nW\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nW\\r\\nB\\r\\n', 'output': ['11\\r\\n']}, {'input': '42 8\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBWBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBWB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBWBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBWBBB\\r\\nBBBBBBBB\\r\\nBBWBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nWBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBWW\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBBBBBBBB\\r\\nBWBBBBBB\\r\\n', 'output': ['1\\r\\n']}, {'input': '4 38\\r\\nWWWWWBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWW\\r\\nWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW\\r\\nWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW\\r\\nWWBWWWWWWWWWWWWWWBWWWWWWWWWWWWWWWWWWWW\\r\\n', 'output': ['2\\r\\n']}, {'input': '9 10\\r\\nWWWWWWBWWW\\r\\nWWWBWWWWWW\\r\\nWBWWWWBWWW\\r\\nWBWBWWWWWW\\r\\nWBWWWWWWWW\\r\\nWWWWWWWWWW\\r\\nWWWWWWWWWB\\r\\nWWWWWWWWBB\\r\\nWWBBWWBWWW\\r\\n', 'output': ['2\\r\\n']}, {'input': '7 47\\r\\nWBWBWWWWBBBBBBWWWWBBBWBWBWBWBBWWWWBBBBWWWWBBWWB\\r\\nWBBBWBWWBBWBWWBWWBWBBBBWWBWBWWBBBBBBBBBWBWBBBBW\\r\\nBBBBWBWBWWBBWWBBBBBWWBBBWWBWBWWWBWWWWBWBBWWBBBW\\r\\nBWBBBBWBBWWWWBWBBWBWBBBBBBWWWWWBBBBBBWWBBBWWBWB\\r\\nBWBBBBBBBBBWBBBBWBWWBWWBBWBBWBBBBBBBWBBBWBBBBWB\\r\\nBBWBBWWWBBWBBBBBWWBBBWWBWBBBWBBBBWWWWBWWBBBWBWB\\r\\nBBBWBBBBWWBWBBWBWBWWBBBBBBBWBBBBBWWBWBBBBBWBWBW\\r\\n', 'output': ['6\\r\\n']}, {'input': '42 1\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\n', 'output': ['10\\r\\n']}, {'input': '25 10\\r\\nWWWWBBBWWW\\r\\nBBBWWBWWBB\\r\\nWBWWBWWWWB\\r\\nBWBWWWBBWB\\r\\nWBWWBWWWBW\\r\\nWBWWBWBBWW\\r\\nWWWWBBWBWW\\r\\nBWBWWWWBBB\\r\\nBBBWWBWWWW\\r\\nBWWWBWBBBW\\r\\nBBWBBBWBBB\\r\\nWBBWWBWWBW\\r\\nBBBBWWWWBW\\r\\nWWWWWWWWWB\\r\\nBWBBWBWBBB\\r\\nBBWWWBBWWW\\r\\nWBWWBWWWWW\\r\\nBWWBBWWWWB\\r\\nWWWWBBBWWW\\r\\nWBBWWWWWWB\\r\\nWBBWWWBBWB\\r\\nWBWWWBBWBW\\r\\nWWBWWWWWBW\\r\\nBWWBWWWBBW\\r\\nBWWWBBBBBB\\r\\n', 'output': ['3\\r\\n']}, {'input': '4 35\\r\\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\\r\\n', 'output': ['1\\r\\n']}, {'input': '39 1\\r\\nB\\r\\nB\\r\\nW\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nW\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nB\\r\\nW\\r\\nW\\r\\nB\\r\\n', 'output': ['10\\r\\n']}, {'input': '18 11\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBWBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBWBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBWBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\nBBBBBBBBBBB\\r\\n', 'output': ['1\\r\\n']}, {'input': '7 20\\r\\nBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBWB\\r\\nBBBBBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBBBBB\\r\\n', 'output': ['1\\r\\n']}, {'input': '45 9\\r\\nBBWBWBBBW\\r\\nWBBBBWBWB\\r\\nBWWBBWWWW\\r\\nBBBBWWBBB\\r\\nWBBBBWWWB\\r\\nWWBWWBBBW\\r\\nBBWBBWBBB\\r\\nWBBBBWBWW\\r\\nBBBWBWBWW\\r\\nBWBWBBWWB\\r\\nBWBWBBWBW\\r\\nBWBBBWBWB\\r\\nBBWBBWWBB\\r\\nWBBBBWBBB\\r\\nWWBWBBBWB\\r\\nBWWBWWBBB\\r\\nBBWBWBWWB\\r\\nWBWWWWBBW\\r\\nBBBWBWBBB\\r\\nWBWWWBBBB\\r\\nBBBWWBWBB\\r\\nWWBBBBBWB\\r\\nBWBBBWWBB\\r\\nBBBWWBWWW\\r\\nBBWBBBBBW\\r\\nWBBWWWBBW\\r\\nBWBWBWWBB\\r\\nBBWBWBBWB\\r\\nBWWBBBBBB\\r\\nBBBBBBBWB\\r\\nBBBBBWWBB\\r\\nWWWBBBBBB\\r\\nWWWBBBBBW\\r\\nWWBBBBBWW\\r\\nWBWBWBWBB\\r\\nBBBBBBBWB\\r\\nBBWBBWBBB\\r\\nBBBWBBBWW\\r\\nWBWWWWWBW\\r\\nBBBBBBWBB\\r\\nBBWBBBWBW\\r\\nBWBBBBWWW\\r\\nBWWBWBBBB\\r\\nBWBBBBBBB\\r\\nBWBWBBBWW\\r\\n', 'output': ['6\\r\\n']}, {'input': '19 9\\r\\nWWWWBWWBW\\r\\nWBWBWBBWB\\r\\nWWBBWWWBB\\r\\nWWBWWWBWW\\r\\nBWBWBWWWW\\r\\nBBBBWBWWB\\r\\nWWWBBBWBW\\r\\nBWWWBWWWB\\r\\nBBBBWWBWW\\r\\nWWWBBBBBB\\r\\nWBWBWBWWW\\r\\nWBBWWWWBB\\r\\nWWBBWBWWB\\r\\nBBWBBBBWB\\r\\nWBWBBWWWB\\r\\nBWBWWBWBW\\r\\nWWBBBWWBW\\r\\nWBBWBWBWB\\r\\nBBWBBWBBB\\r\\n', 'output': ['5\\r\\n']}, {'input': '2 23\\r\\nBBBBWBBBBBBBBBBBWBBBBBW\\r\\nWBBBBWBWBBBBBBWBWBBBWBB\\r\\n', 'output': ['3\\r\\n']}, {'input': '11 1\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\nW\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 39\\r\\nBBBBBBWWBBWBBBBBBBBBBBBBBWBBBBBBBBBBBBB\\r\\nBBBBBWBBBBBBBBBBWBWWBBWBBBBBBBBBBWBBBBB\\r\\n', 'output': ['2\\r\\n']}, {'input': '36 3\\r\\nBBB\\r\\nBBB\\r\\nWWB\\r\\nBBB\\r\\nBBB\\r\\nBWW\\r\\nWBB\\r\\nBBW\\r\\nWBW\\r\\nBBB\\r\\nBBB\\r\\nBBW\\r\\nBWW\\r\\nWBB\\r\\nBWB\\r\\nWWB\\r\\nBBW\\r\\nWBB\\r\\nBBW\\r\\nWBB\\r\\nBBB\\r\\nWWB\\r\\nWBW\\r\\nBBB\\r\\nBWW\\r\\nBBW\\r\\nWBB\\r\\nWBW\\r\\nWWW\\r\\nBWW\\r\\nBWB\\r\\nWBW\\r\\nBWB\\r\\nBBB\\r\\nBBB\\r\\nWBB\\r\\n', 'output': ['7\\r\\n']}, {'input': '5 20\\r\\nWWBBBBWWWWWBWBWBWWBW\\r\\nWBWWWWWWWWWBWWBWWWBW\\r\\nWBWWBWWBWWWWWBBWWWBW\\r\\nWBWBWWWWWBBWWWWBWWWW\\r\\nWBBWBWWBBWBWBWBBWWWW\\r\\n', 'output': ['3\\r\\n']}, {'input': '19 11\\r\\nWWWBWWBBBBB\\r\\nBWBWBWBWWBW\\r\\nWBBWBBBWWBB\\r\\nWWBBBWBBWWW\\r\\nWWWBBWBWBWW\\r\\nBBWBWBWBBBB\\r\\nBWWBWWWBWBB\\r\\nBWBWWBBWBBW\\r\\nBWBWBWWBWWW\\r\\nWWBWBWWWBWB\\r\\nBBBWWWBWWWW\\r\\nBWBWWWWWBBB\\r\\nBWWWBBBWWBB\\r\\nWWWBWBWWBWB\\r\\nWWWWBWWBWWB\\r\\nBWWWBWBWBBB\\r\\nBBWWWWWWWBW\\r\\nWBWWWBWBBWW\\r\\nWBWWWWBWBWB\\r\\n', 'output': ['4\\r\\n']}, {'input': '6 33\\r\\nWBBWWWWWWWWWBBBWWWWWWWWWWWWWWWBWW\\r\\nWBWWBBWBBWWBWWWWWBBBBBBBWWWBWBWBW\\r\\nWBBBBBBWBBWBWWBBWBBBWBWWBBBWWWWWW\\r\\nWWBWBWBBWBWWBWBWBWBBWWWBWWWWWWWWW\\r\\nWWBWWWWBWBBBBWWWWWWWWWBBWWWBWBWWW\\r\\nBWBWWBBBWBWWBWBBBBWBWBBBWWWWBBWWW\\r\\n', 'output': ['4\\r\\n']}, {'input': '22 17\\r\\nBBBBBWBBWWBBBWBBB\\r\\nBBBBBBBBBBBBWBBBB\\r\\nWBBBBBBBBBBBBBBBB\\r\\nBBBBBBBBBBBBBBBBB\\r\\nBBBBWBWBBBBWBBBBW\\r\\nBBBBBWBBWBBBWWBBB\\r\\nBBBWBWBBBBBBBBBBB\\r\\nBBBWBBBBBBBBBBBBB\\r\\nBWBBWWBBBBBBBBBBB\\r\\nBWBBWBBWBBBBBBBBW\\r\\nBBBBBBWWWBWBBBWWW\\r\\nBWBBWBBBBBBWBBWBB\\r\\nBWWBBBBBBBBBBBBBB\\r\\nBBBBBBBBWBWBWBBBB\\r\\nBBBBBBBBWBBBBBBBB\\r\\nBBBBBBBBBBBBBBWBB\\r\\nBBBWWBBBBBBWWBBBB\\r\\nBBBBBBBWBBBBBBBBB\\r\\nBBBWBBBBBBWBBBBBB\\r\\nWBWBWBBBBBBBWBBBB\\r\\nBBBBBWBBBBBBBBBBB\\r\\nBBBWBBBBBBBBBBBBB\\r\\n', 'output': ['1\\r\\n']}, {'input': '36 6\\r\\nBWWWBW\\r\\nBBBBWB\\r\\nBWWBBB\\r\\nBWBWBB\\r\\nBBBBBB\\r\\nBWWBBW\\r\\nBWBWBW\\r\\nWBBBBB\\r\\nWBBBBB\\r\\nBBWBBB\\r\\nBWBBWB\\r\\nBBWWWB\\r\\nWBBBBB\\r\\nBWBWBB\\r\\nBBBBBW\\r\\nBWWWWB\\r\\nBBBBWB\\r\\nBBBBBB\\r\\nBWBBBB\\r\\nWBWBWB\\r\\nBBBBWW\\r\\nBWBBWB\\r\\nWBBBBW\\r\\nBBBWWW\\r\\nWBBBBB\\r\\nBBBBBW\\r\\nBBBBBW\\r\\nBBBBWW\\r\\nBBBWBW\\r\\nBWBBBB\\r\\nBWBBBW\\r\\nWWBBBW\\r\\nWBWBWB\\r\\nBBBWBW\\r\\nBBWBBB\\r\\nBBBBBB\\r\\n', 'output': ['3\\r\\n']}, {'input': '24 1\\r\\nW\\r\\nB\\r\\nW\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nW\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\nB\\r\\n', 'output': ['3\\r\\n']}, {'input': '7 7\\r\\nBBBBBBB\\r\\nBWWWWWB\\r\\nBWBBBWB\\r\\nBWBWBWB\\r\\nBWBBBWB\\r\\nBWWWWWB\\r\\nBBBBBBB\\r\\n', 'output': ['2\\r\\n']}, {'input': '4 4\\r\\nBWWW\\r\\nWBWB\\r\\nBWBW\\r\\nWBWB\\r\\n', 'output': ['3\\r\\n']}, {'input': '5 5\\r\\nWBWWW\\r\\nBWBWW\\r\\nWBWWB\\r\\nWWBBW\\r\\nWWBWB\\r\\n', 'output': ['3\\r\\n']}, {'input': '10 10\\r\\nBBWWBBBBBW\\r\\nBWWWWBWBWB\\r\\nWBWBWBBBBW\\r\\nWWBBWBBBBW\\r\\nBBBBBBBBBW\\r\\nBBBWWBBWWB\\r\\nWBBWBWWWWB\\r\\nWWWBBBBBWW\\r\\nWBBBBBWBBB\\r\\nWBWWBWWBBB\\r\\n', 'output': ['3\\r\\n']}, {'input': '7 7\\r\\nWBWBBBW\\r\\nBBBWBBW\\r\\nWWWWBWB\\r\\nBBWWBBW\\r\\nWWBWBWW\\r\\nBWWBBWW\\r\\nWWBWBWW\\r\\n', 'output': ['3\\r\\n']}, {'input': '6 6\\r\\nWWWWBB\\r\\nWBWBWW\\r\\nBBBWBW\\r\\nBWWWWB\\r\\nWBBBBW\\r\\nBBWWWB\\r\\n', 'output': ['3\\r\\n']}]","id":113} {"description":"Berland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1,\u2009l2,\u2009...,\u2009ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn\u2019t make pauses between the words, but at the same time they could always understand each other perfectly. It was possible because no word was a prefix of another one. The prefix of a string is considered to be one of its substrings that starts from the initial symbol.Help the scientists determine whether all the words of the Old Berland language can be reconstructed and if they can, output the words themselves.","input_specification":"The first line contains one integer N (1\u2009\u2264\u2009N\u2009\u2264\u20091000) \u2014 the number of words in Old Berland language. The second line contains N space-separated integers \u2014 the lengths of these words. All the lengths are natural numbers not exceeding 1000.","output_specification":"If there\u2019s no such set of words, in the single line output NO. Otherwise, in the first line output YES, and in the next N lines output the words themselves in the order their lengths were given in the input file. If the answer is not unique, output any.","notes":null,"sample_inputs":["3\n1 2 3","3\n1 1 1"],"sample_outputs":["YES\n0\n10\n110","NO"],"src_uid":"1670a3d7dba83e29e98f0ac6fe4acb18","lang_cluster":"Java","difficulty":1900,"human_solution":"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n static class Pair implements Comparable {\n public Integer first;\n public Integer second;\n public Pair(Integer first, Integer second) {\n this.first = first;\n this.second = second;\n }\n @Override\n public int compareTo(Pair other) {\n return this.first.compareTo(other.first);\n }\n }\n\n static class Node {\n public int isBlock = 0;\n public Node[] child;\n public Node pre;\n public Node() {\n this.isBlock = 0;\n this.pre = null;\n this.child = new Node[2];\n Arrays.fill(child, null);\n }\n }\n\n private static int maxn = 1000001;\n private static int MAX = 2;\n private static String[] ans = new String[10001];\n private static String s;\n\n private static Node root = new Node();\n\n private static boolean add(int l) {\n Node temp = root;\n if (root.isBlock == 1)\n return false;\n s = \"\";\n for (int i = 0; i < l; i++) {\n int check_l = -1;\n boolean canmove = false;\n for (int j = MAX - 1; j >= 0; j--) {\n if (temp.child[j] != null) {\n if (temp.child[j].isBlock == 0) {\n s = s + (char) ('0' + j);\n temp = temp.child[j];\n canmove = true;\n break;\n }\n }\n if (temp.child[j] == null)\n check_l = j;\n }\n\n if (!canmove) {\n if (check_l == -1)\n return false;\n else {\n s = s + (char) ('0' + check_l);\n temp.child[check_l] = new Node();\n temp.child[check_l].pre = temp;\n temp = temp.child[check_l];\n }\n }\n }\n\n temp.isBlock = 1;\n\n while (temp != null) {\n if (temp.child[0] != null && temp.child[1] != null)\n if (temp.child[0].isBlock * temp.child[1].isBlock == 1)\n temp.isBlock = 1;\n temp = temp.pre;\n }\n\n return true;\n\n }\n\n public static void main(String[] args) {\n \n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Pair[] a = new Pair[n + 1];\n for (int i = 0; i < n; i++) {\n int l = sc.nextInt();\n a[i] = new Pair(l, i);\n }\n\n Arrays.sort(a, 0, n);\n\n for (int i = 0; i < n; i++) {\n int l = a[i].first;\n if (add(l) == false) {\n System.out.println(\"NO\");\n return;\n }\n else\n ans[a[i].second] = s;\n }\n\n System.out.println(\"YES\");\n for (int i = 0; i < n; i++)\n System.out.println(ans[i]);\n\n sc.close();\n\n }\n\n}","testcases":"[{'input': '3\\r\\n1 2 3\\r\\n', 'output': ['YES\\r\\n0\\r\\n10\\r\\n110\\r\\n']}, {'input': '3\\r\\n1 1 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10\\r\\n4 4 4 4 4 4 4 4 4 4\\r\\n', 'output': ['YES\\r\\n0000\\r\\n0001\\r\\n0010\\r\\n0011\\r\\n0100\\r\\n0101\\r\\n0110\\r\\n0111\\r\\n1000\\r\\n1001\\r\\n']}, {'input': '20\\r\\n6 7 7 7 7 6 7 7 7 7 7 7 7 7 7 7 7 7 6 7\\r\\n', 'output': ['YES\\r\\n000000\\r\\n0000110\\r\\n0000111\\r\\n0001000\\r\\n0001001\\r\\n000001\\r\\n0001010\\r\\n0001011\\r\\n0001100\\r\\n0001101\\r\\n0001110\\r\\n0001111\\r\\n0010000\\r\\n0010001\\r\\n0010010\\r\\n0010011\\r\\n0010100\\r\\n0010101\\r\\n000010\\r\\n0010110\\r\\n']}, {'input': '30\\r\\n9 10 8 10 10 10 10 10 7 7 10 10 10 10 10 10 10 10 10 10 9 10 10 10 10 10 10 10 4 3\\r\\n', 'output': ['YES\\r\\n001101010\\r\\n0011011000\\r\\n00110100\\r\\n0011011001\\r\\n0011011010\\r\\n0011011011\\r\\n0011011100\\r\\n0011011101\\r\\n0011000\\r\\n0011001\\r\\n0011011110\\r\\n0011011111\\r\\n0011100000\\r\\n0011100001\\r\\n0011100010\\r\\n0011100011\\r\\n0011100100\\r\\n0011100101\\r\\n0011100110\\r\\n0011100111\\r\\n001101011\\r\\n0011101000\\r\\n0011101001\\r\\n0011101010\\r\\n0011101011\\r\\n0011101100\\r\\n0011101101\\r\\n0011101110\\r\\n0010\\r\\n000\\r\\n']}, {'input': '20\\r\\n4 4 3 4 4 4 4 4 4 4 4 3 3 2 1 4 4 3 3 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '30\\r\\n6 7 7 6 7 7 7 7 7 7 7 7 7 7 7 5 7 7 7 7 2 1 5 3 7 3 2 7 5 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '65\\r\\n7 8 6 9 10 9 10 10 9 10 10 10 10 10 10 9 9 10 9 10 10 6 9 7 7 6 8 10 10 8 4 5 2 3 5 3 6 5 2 4 10 4 2 8 10 1 1 4 5 3 8 5 6 7 6 1 10 5 2 8 4 9 1 2 7\\r\\n', 'output': ['NO\\r\\n']}, {'input': '85\\r\\n7 9 8 9 5 6 9 8 10 10 9 10 10 10 10 7 7 4 8 7 7 7 9 10 10 9 10 9 10 10 10 8 8 10 10 10 10 10 10 10 10 10 10 10 10 10 10 9 7 10 4 2 9 3 3 6 2 6 5 6 4 1 7 3 7 7 5 8 4 5 4 1 10 2 9 3 1 4 2 9 9 3 5 6 8\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10\\r\\n4 4 4 4 4 4 4 4 2 2\\r\\n', 'output': ['YES\\r\\n1000\\r\\n1001\\r\\n1010\\r\\n1011\\r\\n1100\\r\\n1101\\r\\n1110\\r\\n1111\\r\\n00\\r\\n01\\r\\n']}, {'input': '20\\r\\n5 4 5 5 5 6 5 6 4 5 6 4 5 4 2 4 6 4 4 5\\r\\n', 'output': ['YES\\r\\n10110\\r\\n0100\\r\\n10111\\r\\n11000\\r\\n11001\\r\\n111100\\r\\n11010\\r\\n111101\\r\\n0101\\r\\n11011\\r\\n111110\\r\\n0110\\r\\n11100\\r\\n0111\\r\\n00\\r\\n1000\\r\\n111111\\r\\n1001\\r\\n1010\\r\\n11101\\r\\n']}, {'input': '30\\r\\n7 8 6 4 2 8 8 7 7 10 4 6 4 7 4 4 7 6 7 9 7 3 5 5 10 4 5 8 5 8\\r\\n', 'output': ['YES\\r\\n1110110\\r\\n11111010\\r\\n111000\\r\\n0110\\r\\n00\\r\\n11111011\\r\\n11111100\\r\\n1110111\\r\\n1111000\\r\\n1111111110\\r\\n0111\\r\\n111001\\r\\n1000\\r\\n1111001\\r\\n1001\\r\\n1010\\r\\n1111010\\r\\n111010\\r\\n1111011\\r\\n111111110\\r\\n1111100\\r\\n010\\r\\n11000\\r\\n11001\\r\\n1111111111\\r\\n1011\\r\\n11010\\r\\n11111101\\r\\n11011\\r\\n11111110\\r\\n']}, {'input': '50\\r\\n4 7 9 7 7 5 5 5 8 9 9 7 9 7 7 6 5 6 4 9 6 5 6 6 5 7 7 6 6 6 5 8 2 7 8 7 6 5 7 9 8 7 5 6 6 8 6 6 7 7\\r\\n', 'output': ['YES\\r\\n0100\\r\\n1101110\\r\\n111111010\\r\\n1101111\\r\\n1110000\\r\\n01100\\r\\n01101\\r\\n01110\\r\\n11111000\\r\\n111111011\\r\\n111111100\\r\\n1110001\\r\\n111111101\\r\\n1110010\\r\\n1110011\\r\\n101010\\r\\n01111\\r\\n101011\\r\\n0101\\r\\n111111110\\r\\n101100\\r\\n10000\\r\\n101101\\r\\n101110\\r\\n10001\\r\\n1110100\\r\\n1110101\\r\\n101111\\r\\n110000\\r\\n110001\\r\\n10010\\r\\n11111001\\r\\n00\\r\\n1110110\\r\\n11111010\\r\\n1110111\\r\\n110010\\r\\n10011\\r\\n1111000\\r\\n111111111\\r\\n11111011\\r\\n1111001\\r\\n10100\\r\\n110011\\r\\n110100\\r\\n11111100\\r\\n110101\\r\\n110110\\r\\n1111010\\r\\n1111011\\r\\n']}, {'input': '20\\r\\n2 3 4 4 2 4 4 2 4 4 3 4 4 3 1 3 3 3 2 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '30\\r\\n6 6 6 5 6 7 3 4 6 5 2 4 6 4 5 4 6 5 4 4 6 6 2 1 4 4 6 1 6 7\\r\\n', 'output': ['NO\\r\\n']}, {'input': '65\\r\\n9 7 8 6 6 10 3 9 10 4 8 3 2 8 9 1 6 3 2 7 9 7 8 10 10 4 5 6 8 8 7 10 10 8 6 6 4 8 8 7 6 9 10 7 8 7 3 3 10 8 9 10 1 9 6 9 2 7 9 10 8 10 3 7 3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '85\\r\\n9 10 4 5 10 4 10 4 5 7 4 8 10 10 9 6 10 10 7 1 10 8 4 4 7 6 3 9 4 4 9 6 3 3 8 9 8 8 10 6 10 10 4 9 6 9 4 3 4 5 8 6 1 5 9 9 9 7 10 10 7 10 4 4 8 2 1 8 10 10 7 1 3 10 7 10 4 5 10 1 10 8 6 2 10\\r\\n', 'output': ['NO\\r\\n']}, {'input': '200\\r\\n11 23 6 1 15 6 5 9 8 9 13 11 7 21 14 17 8 8 12 6 18 4 9 20 3 9 6 9 9 12 18 5 22 5 16 20 11 6 22 10 5 6 8 19 9 12 14 2 10 6 7 7 18 17 4 16 9 13 3 10 15 8 8 9 13 7 8 18 12 12 13 14 9 8 5 5 22 19 23 15 11 7 23 7 5 3 9 3 15 9 22 9 2 11 21 8 12 7 6 8 10 6 12 9 11 8 7 6 5 7 8 9 10 7 19 12 14 9 6 7 2 7 8 4 12 21 14 4 11 12 9 13 17 4 10 8 17 3 9 5 11 6 4 11 1 13 10 10 8 10 14 23 17 8 20 23 23 23 14 7 18 5 10 21 9 7 7 7 4 23 13 8 9 22 7 4 8 12 8 19 17 11 10 8 8 7 7 13 6 13 14 14 22 2 10 11 5 1 14 13\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['YES\\r\\n0\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['YES\\r\\n0\\r\\n1\\r\\n']}, {'input': '3\\r\\n1 1 2\\r\\n', 'output': ['NO\\r\\n']}]","id":114} {"description":"Berland scientists noticed long ago that the world around them depends on Berland population. Due to persistent research in this area the scientists managed to find out that the Berland chronology starts from the moment when the first two people came to that land (it is considered to have happened in the first year). After one Berland year after the start of the chronology the population had already equaled 13 people (the second year). However, tracing the population number during the following years was an ultimately difficult task, still it was found out that if di \u2014 the number of people in Berland in the year of i, then either di\u2009=\u200912di\u2009-\u20092, or di\u2009=\u200913di\u2009-\u20091\u2009-\u200912di\u2009-\u20092. Of course no one knows how many people are living in Berland at the moment, but now we can tell if there could possibly be a year in which the country population equaled A. That's what we ask you to determine. Also, if possible, you have to find out in which years it could be (from the beginning of Berland chronology). Let's suppose that it could be in the years of a1,\u2009a2,\u2009...,\u2009ak. Then you have to define how many residents could be in the country during those years apart from the A variant. Look at the examples for further explanation.","input_specification":"The first line contains integer A (1\u2009\u2264\u2009A\u2009<\u200910300). It is guaranteed that the number doesn't contain leading zeros.","output_specification":"On the first output line print YES, if there could be a year in which the total population of the country equaled A, otherwise print NO. If the answer is YES, then you also have to print number k \u2014 the number of years in which the population could equal A. On the next line you have to output precisely k space-separated numbers \u2014 a1,\u2009a2,\u2009...,\u2009ak. Those numbers have to be output in the increasing order. On the next line you should output number p \u2014 how many variants of the number of people could be in the years of a1,\u2009a2,\u2009...,\u2009ak, apart from the A variant. On each of the next p lines you have to print one number \u2014 the sought number of residents. Those number also have to go in the increasing order. If any number (or both of them) k or p exceeds 1000, then you have to print 1000 instead of it and only the first 1000 possible answers in the increasing order. The numbers should have no leading zeros.","notes":null,"sample_inputs":["2","3","13","1729"],"sample_outputs":["YES\n1\n1\n0","NO","YES\n1\n2\n0","YES\n1\n4\n1\n156"],"src_uid":"0ef5e0621f13107d0c8786766ae2ac56","lang_cluster":"Java","difficulty":2600,"human_solution":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\nimport java.util.ArrayList;\nimport java.util.List;\n\n\npublic class Main {\n\n\t\/**\n\t * @param args\n\t * @throws IOException \n\t *\/\n\tpublic static void main(String[] args) throws IOException {\n\t\t\/\/ TODO Auto-generated method stub\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\tBigInteger A = new BigInteger(bf.readLine().trim());\n\t\tList pow = new ArrayList();\n\t\tpow.add(BigInteger.ONE);\n\t\tBigInteger twl = new BigInteger(\"12\");\n\t\tfor (int i=1; i<600; i++) {\n\t\t\tpow.add(pow.get(i-1).multiply(twl));\n\t\t}\n\t\tint n = -1;\n\t\tfor (int i=0;i<600;i++) {\n\t\t\tfor (int j=0;j<=i\/2;j++) {\n\t\t\t\tif (pow.get(j).add(pow.get(i-j)).compareTo(A) == 0) {\n\t\t\t\t\tn = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (n == -1) {\n\t\t\tSystem.out.println(\"NO\");\n\t\t} else {\n\t\t\tSystem.out.printf(\"YES\\n1\\n%d\\n%d\\n\", n + 1, n\/2);\n\t\t\t\n\t\t\tfor (int j=n\/2; j>=0; j--) {\n\t\t\t\tif (pow.get(j).add(pow.get(n-j)).compareTo(A) != 0) {\n\t\t\t\t\tSystem.out.println(pow.get(j).add(pow.get(n-j)));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\n","testcases":"[{'input': '2\\r\\n', 'output': ['YES\\r\\n1\\r\\n1\\r\\n0\\r\\n']}, {'input': '3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '13\\r\\n', 'output': ['YES\\r\\n1\\r\\n2\\r\\n0\\r\\n']}, {'input': '1729\\r\\n', 'output': ['YES\\r\\n1\\r\\n4\\r\\n1\\r\\n156\\r\\n']}, {'input': '1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '156\\r\\n', 'output': ['YES\\r\\n1\\r\\n4\\r\\n1\\r\\n1729\\r\\n']}, {'input': '144\\r\\n', 'output': ['NO\\r\\n']}, {'input': '15407021574586369\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n']}, {'input': '1283918464548876\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n15407021574586369\\r\\n']}, {'input': '106993205379216\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '8916100449984\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '743008391424\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '61917613056\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '5162766336\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '465813504\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '1190892770349870530939783612223854919520376583681977765887915460625605936058755310651852367291739265953207545289130222590192089760107219016552443777446454737593270848929686985225627328165141495957916933183554147885929489200931370369335342990301385609877410822418323040587200691179244114277235163137\\r\\n', 'output': ['NO\\r\\n']}, {'input': '595446385174935265469891806111927459760188291840988882943957730312802968029377655325926183645869632976603772644565111295096044880053609508276221888723227368796635424464843492612813664082570747978958466591777073942964744600465685184667671495150692804938705411209161520293600345589622057138617581568\\r\\n', 'output': ['NO\\r\\n']}, {'input': '25\\r\\n', 'output': ['NO\\r\\n']}, {'input': '941796563564014133460267652699405064136604147775680640408635568423120076418612383600961606320075481457728632621229496557902028935524874377670656752361237195740789199168688114539822313589449591752852405348364368488613997844015773837981050319855641810991084718329572826001220219\\r\\n', 'output': ['NO\\r\\n']}, {'input': '79360359146807441660707083821018832188095237636414144034857851003419752010124705615779249215657075053438039921073878645370211154334804568157886814559909\\r\\n', 'output': ['NO\\r\\n']}, {'input': '63730052926382178992698271572\\r\\n', 'output': ['NO\\r\\n']}, {'input': '781127467969689863953686682245136076127159921705034542049372816247984349746396880068864077830521695515007722284098436125466526268962707778595903329840419133974864831578401355678018910046595664462\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6158324958633591462725987806787114657822761584945953440793358408\\r\\n', 'output': ['NO\\r\\n']}, {'input': '46865942276811740149949176718949673344632458696505595472917789224885825949034661409971763949176343056701403524645790892802371117466746709730235969308113002256137529699677021858777002204698794034488631496662175642982367736619451227\\r\\n', 'output': ['NO\\r\\n']}, {'input': '30237645054497458443810364460387991000047179363449854478913094584184671326397148735574822623728870964468880\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2340834982489248497640077401144544875656219324259480464300721974528452789353163588007890141857933775490305682107276886017882071992830194933217950703328428111517059826130590646975303231172522274173055168264136989194405810785131454927884294753122224538370897882934059\\r\\n', 'output': ['NO\\r\\n']}, {'input': '188808426143782131983811729737047667239979348184409855460833141044812532916921011366813880911319644625405122800255947507577498497005580408229\\r\\n', 'output': ['NO\\r\\n']}, {'input': '11\\r\\n', 'output': ['NO\\r\\n']}, {'input': '837952166310387766556098005402621146120844433859027080340550200820\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6658370691480968202384509492140362150472696196949673577340706113760133821635599667476781507918250717914609488172442814676\\r\\n', 'output': ['NO\\r\\n']}, {'input': '496620932866717074931903995027173085744596193421095444317407919730992986418713478580824584919587030125446806223296721174921873955469939680411818878465888018986191990428049489376\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1055050055824280186133547527395898666709023463559337207019374080060005629519967890329878081184599905695126755199503698703340223998620951421943134090897041663457029971964336512111472968057533187306110300592753045593222495258017559167383354672\\r\\n', 'output': ['NO\\r\\n']}, {'input': '833488\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6623739799588591251984406341341227075747347067457011846886851179047097\\r\\n', 'output': ['NO\\r\\n']}, {'input': '491137842784568289872893698937459777201151060689848471272003426250808340375567208957554901863756992593841404624991936090178731\\r\\n', 'output': ['NO\\r\\n']}, {'input': '921020945402270233565256424740666649108666245414796768645533036514715926608741510409618545180420952947917462937925573726593991655435868735899832746218676826629010574075553051352459309199055\\r\\n', 'output': ['NO\\r\\n']}, {'input': '73010581613999159726778758153209240813500342925961695523976131595080552126499402124287397930918281238199343324378719343080627189983992629778313739785259010389762036264197722427990331444297391895841265448905560880286941336214995793596526089977876\\r\\n', 'output': ['NO\\r\\n']}, {'input': '20046142930690780976270827075270\\r\\n', 'output': ['NO\\r\\n']}, {'input': '9685166910821197056344900917707673568669808490600751439157007968027004377622601634787545920946543261243701428886581331490848676434786296227674864970612484770201\\r\\n', 'output': ['NO\\r\\n']}, {'input': '8135498415686025907059626116077260223347794805104214588176486213766836727225732896611278946787711775240855660997946707132990500568944980168321229607627861318462551364491230037357687242571268657488824365976425738641613571689437917277074234256494445914221354904615014917288299991097350709814\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4805043123239964766764344326469867688727869311599746349016084457204677169811854267718990063526979167327981002200329174783850464\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2376595620091080825479292544658464163405755746884100218035485700973409491416884420742631899446144679322008453313773241425622490028383089317622842863337164723765526589656211098933400307364163919083790470365474085981340438888606855706394352678991102\\r\\n', 'output': ['NO\\r\\n']}, {'input': '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n', 'output': ['NO\\r\\n']}, {'input': '145\\r\\n', 'output': ['YES\\r\\n1\\r\\n3\\r\\n1\\r\\n24\\r\\n']}, {'input': '24\\r\\n', 'output': ['YES\\r\\n1\\r\\n3\\r\\n1\\r\\n145\\r\\n']}, {'input': '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n', 'output': ['NO\\r\\n']}]","id":115} {"description":"Today you are to solve the problem even the famous Hercule Poirot can't cope with! That's why this crime has not yet been solved and this story was never included in Agatha Christie's detective story books. You are not informed on what crime was committed, when and where the corpse was found and other details. We only know that the crime was committed in a house that has n rooms and m doors between the pairs of rooms. The house residents are very suspicious, that's why all the doors can be locked with keys and all the keys are different. According to the provided evidence on Thursday night all the doors in the house were locked, and it is known in what rooms were the residents, and what kind of keys had any one of them. The same is known for the Friday night, when all the doors were also locked. On Friday it was raining heavily, that's why nobody left the house and nobody entered it. During the day the house residents could open and close doors to the neighboring rooms using the keys at their disposal (every door can be opened and closed from each side); move freely from a room to a room if a corresponding door is open; give keys to one another, being in one room. \"Little grey matter\" of Hercule Poirot are not capable of coping with such amount of information. Find out if the positions of people and keys on the Thursday night could result in the positions on Friday night, otherwise somebody among the witnesses is surely lying.","input_specification":"The first line contains three preset integers n, m \u0438 k (1\u2009\u2264\u2009n,\u2009m,\u2009k\u2009\u2264\u20091000) \u2014 the number of rooms, the number of doors and the number of house residents respectively. The next m lines contain pairs of room numbers which join the doors. The rooms are numbered with integers from 1 to n. There cannot be more that one door between the pair of rooms. No door connects a room with itself. The next k lines describe the residents' position on the first night. Every line contains a resident's name (a non-empty line consisting of no more than 10 Latin letters), then after a space follows the room number, then, after a space \u2014 the number of keys the resident has. Then follow written space-separated numbers of the doors that can be unlocked by these keys. The doors are numbered with integers from 1 to m in the order in which they are described in the input data. All the residents have different names, uppercase and lowercase letters considered to be different. Every m keys occurs exactly once in the description. Multiple people may be present in one room, some rooms may be empty. The next k lines describe the position of the residents on the second night in the very same format. It is guaranteed that in the second night's description the residents' names remain the same and every m keys occurs exactly once.","output_specification":"Print \"YES\" (without quotes) if the second arrangement can result from the first one, otherwise, print \"NO\".","notes":null,"sample_inputs":["2 1 2\n1 2\nDmitry 1 1 1\nNatalia 2 0\nNatalia 1 1 1\nDmitry 2 0","4 4 3\n1 3\n1 2\n2 3\n3 4\nArtem 1 1 4\nDmitry 1 1 2\nEdvard 4 2 1 3\nArtem 2 0\nDmitry 1 0\nEdvard 4 4 1 2 3 4"],"sample_outputs":["YES","NO"],"src_uid":"52b13cca189853e6af02bea8d3d85276","lang_cluster":"Java","difficulty":2300,"human_solution":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\npublic class Rooms implements Runnable {\n static class Door {\n int a;\n int b;\n }\n\n static class Component {\n Set names = new HashSet();\n Set keys = new HashSet();\n\n public int size() {\n return names.size() + keys.size();\n }\n }\n\n private void solve() throws IOException {\n int n = nextInt();\n int m = nextInt();\n int k = nextInt();\n Door[] door = new Door[m];\n for (int i = 0; i < m; ++i) {\n door[i] = new Door();\n door[i].a = nextInt() - 1;\n door[i].b = nextInt() - 1;\n }\n Component[][] res = new Component[2][];\n for (int step = 0; step < 2; ++step) {\n Component[] where = new Component[n];\n for (int i = 0; i < n; ++i) {\n where[i] = new Component();\n }\n for (int i = 0; i < k; ++i) {\n String name = nextToken();\n int room = nextInt() - 1;\n Component cur = where[room];\n cur.names.add(name);\n int cnt = nextInt();\n for (int j = 0; j < cnt; ++j) {\n cur.keys.add(door[nextInt() - 1]);\n }\n }\n while (true) {\n boolean changed = false;\n for (Door d : door) {\n if (where[d.a] == where[d.b])\n continue;\n if (where[d.a].keys.contains(d) || where[d.b].keys.contains(d)) {\n changed = true;\n Component a = where[d.a];\n Component b = where[d.b];\n a.keys.addAll(b.keys);\n a.names.addAll(b.names);\n for (int i = 0; i < n; ++i)\n if (where[i] == b)\n where[i] = a;\n }\n }\n if (!changed)\n break;\n }\n res[step] = where;\n }\n boolean result = true;\n for (int i = 0; i < n; ++i) {\n Component a = res[0][i];\n Component b = res[1][i];\n if (a.names.equals(b.names) && a.keys.equals(b.keys))\n continue;\n result = false;\n break;\n }\n if (result)\n writer.println(\"YES\");\n else\n writer.println(\"NO\");\n\n }\n\n public static void main(String[] args) {\n new Rooms().run();\n }\n\n BufferedReader reader;\n StringTokenizer tokenizer;\n PrintWriter writer;\n\n public void run() {\n try {\n reader = new BufferedReader(new InputStreamReader(System.in));\n tokenizer = null;\n writer = new PrintWriter(System.out);\n solve();\n reader.close();\n writer.close();\n } catch (Exception e) {\n e.printStackTrace();\n System.exit(1);\n }\n }\n\n int nextInt() throws IOException {\n return Integer.parseInt(nextToken());\n }\n\n long nextLong() throws IOException {\n return Long.parseLong(nextToken());\n }\n\n double nextDouble() throws IOException {\n return Double.parseDouble(nextToken());\n }\n\n String nextToken() throws IOException {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n tokenizer = new StringTokenizer(reader.readLine());\n }\n return tokenizer.nextToken();\n }\n}","testcases":"[{'input': '2 1 2\\r\\n1 2\\r\\nDmitry 1 1 1\\r\\nNatalia 2 0\\r\\nNatalia 1 1 1\\r\\nDmitry 2 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4 4 3\\r\\n1 3\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\nArtem 1 1 4\\r\\nDmitry 1 1 2\\r\\nEdvard 4 2 1 3\\r\\nArtem 2 0\\r\\nDmitry 1 0\\r\\nEdvard 4 4 1 2 3 4\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 1 1\\r\\n2 1\\r\\nabsgdf 1 1 1\\r\\nabsgdf 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '2 1 1\\r\\n2 1\\r\\nabsgdf 2 1 1\\r\\nabsgdf 1 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\na 1 1 1\\r\\nb 2 1 3\\r\\nc 3 1 2\\r\\na 3 1 3\\r\\nb 1 0\\r\\nc 2 2 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '3 3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\na 1 1 1\\r\\nb 2 1 3\\r\\nc 3 1 2\\r\\nb 1 1 2\\r\\nc 2 1 3\\r\\na 3 1 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\nb 1 1 2\\r\\nc 2 1 3\\r\\na 3 1 1\\r\\na 3 1 3\\r\\nb 1 0\\r\\nc 2 2 1 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4 5 3\\r\\n1 2\\r\\n2 3\\r\\n2 4\\r\\n1 3\\r\\n1 3\\r\\na 1 2 4 3\\r\\nb 1 0\\r\\nc 4 3 1 2 5\\r\\na 1 2 4 3\\r\\nb 1 1 5\\r\\nc 4 2 1 2\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 2 2\\r\\n1 2\\r\\n2 1\\r\\nA 1 1 2\\r\\nB 1 1 1\\r\\nA 1 0\\r\\nB 2 2 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4 2 4\\r\\n2 1\\r\\n4 3\\r\\na 1 1 1\\r\\nb 2 1 2\\r\\nc 3 0\\r\\nd 4 0\\r\\na 2 1 2\\r\\nb 1 1 1\\r\\nc 3 0\\r\\nd 4 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '4 2 4\\r\\n2 1\\r\\n4 3\\r\\na 1 1 1\\r\\nb 2 1 2\\r\\nc 3 0\\r\\nd 4 0\\r\\na 2 1 2\\r\\nb 1 1 1\\r\\nc 4 0\\r\\nd 3 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6 3 4\\r\\n1 2\\r\\n3 4\\r\\n5 6\\r\\na 1 2 1 3\\r\\nb 3 1 2\\r\\nc 5 0\\r\\nd 6 0\\r\\na 2 2 1 3\\r\\nb 4 1 2\\r\\nc 5 0\\r\\nd 6 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '6 3 4\\r\\n1 2\\r\\n3 4\\r\\n5 6\\r\\na 1 2 1 3\\r\\nb 3 1 2\\r\\nc 5 0\\r\\nd 6 0\\r\\na 2 1 1\\r\\nb 4 2 2 3\\r\\nc 5 0\\r\\nd 6 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10 20 5\\r\\n2 1\\r\\n3 1\\r\\n4 2\\r\\n5 1\\r\\n6 5\\r\\n7 2\\r\\n8 5\\r\\n9 8\\r\\n10 6\\r\\n2 6\\r\\n3 5\\r\\n3 4\\r\\n10 5\\r\\n8 3\\r\\n9 4\\r\\n10 8\\r\\n9 2\\r\\n6 3\\r\\n3 8\\r\\n9 8\\r\\nDKkXdT 10 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\\r\\nOzvgPXMzAr 5 0\\r\\nbjac 3 0\\r\\ncBPbJtoND 6 0\\r\\nw 5 0\\r\\nbjac 4 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\\r\\nOzvgPXMzAr 2 0\\r\\ncBPbJtoND 5 0\\r\\nw 10 0\\r\\nDKkXdT 4 0\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 9 10\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 8\\r\\n8 9\\r\\n9 10\\r\\nInCeN 1 0\\r\\nIzHqPceNhj 2 1 9\\r\\neH 3 1 8\\r\\nJvgBsNFi 4 1 7\\r\\nBA 5 1 6\\r\\nRrjSTXJzhL 6 1 5\\r\\nDMx 7 1 4\\r\\nJzt 8 1 3\\r\\nhxBRlDlqwD 9 1 2\\r\\nImWeEPkggZ 10 1 1\\r\\neH 1 0\\r\\nImWeEPkggZ 2 1 9\\r\\nDMx 3 1 8\\r\\nIzHqPceNhj 4 1 7\\r\\nInCeN 5 1 6\\r\\nJvgBsNFi 6 1 5\\r\\nRrjSTXJzhL 7 1 4\\r\\nJzt 8 1 3\\r\\nhxBRlDlqwD 9 1 2\\r\\nBA 10 1 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '11 10 11\\r\\n1 2\\r\\n2 11\\r\\n3 4\\r\\n4 11\\r\\n5 6\\r\\n6 11\\r\\n7 8\\r\\n8 11\\r\\n9 10\\r\\n10 11\\r\\na 1 1 9\\r\\nb 2 1 10\\r\\nc 3 0\\r\\nd 4 1 1\\r\\ne 5 1 3\\r\\nf 6 1 4\\r\\ng 7 1 5\\r\\nh 8 1 6\\r\\ni 9 1 7\\r\\nj 10 1 8\\r\\nk 11 1 2\\r\\na 1 0\\r\\nb 2 0\\r\\nc 3 0\\r\\nd 4 0\\r\\ne 5 0\\r\\nf 6 0\\r\\ng 7 0\\r\\nh 8 0\\r\\ni 9 0\\r\\nj 10 0\\r\\nk 11 10 1 2 3 4 5 6 7 8 9 10\\r\\n', 'output': ['YES\\r\\n']}, {'input': '11 10 11\\r\\n1 2\\r\\n2 11\\r\\n3 4\\r\\n4 11\\r\\n5 6\\r\\n6 11\\r\\n7 8\\r\\n8 11\\r\\n9 10\\r\\n10 11\\r\\na 1 0\\r\\nb 2 0\\r\\nc 3 0\\r\\nd 4 0\\r\\ne 5 0\\r\\nf 6 0\\r\\ng 7 0\\r\\nh 8 0\\r\\ni 9 0\\r\\nj 10 0\\r\\nk 11 10 1 2 3 4 5 6 7 8 9 10\\r\\na 1 1 9\\r\\nb 2 1 10\\r\\nc 3 0\\r\\nd 4 1 1\\r\\ne 5 1 3\\r\\nf 6 1 4\\r\\ng 7 1 5\\r\\nh 8 1 6\\r\\ni 9 1 7\\r\\nj 10 1 8\\r\\nk 11 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '7 8 2\\r\\n3 7\\r\\n7 6\\r\\n1 2\\r\\n4 5\\r\\n1 3\\r\\n5 6\\r\\n4 6\\r\\n2 3\\r\\na 7 4 3 8 5 2\\r\\nb 7 4 4 6 7 1\\r\\na 1 4 3 8 5 2\\r\\nb 4 4 4 6 7 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7 8 2\\r\\n3 7\\r\\n7 6\\r\\n1 2\\r\\n4 5\\r\\n1 3\\r\\n5 6\\r\\n4 6\\r\\n2 3\\r\\na 1 4 3 8 5 2\\r\\nb 4 4 4 6 7 1\\r\\na 3 4 3 8 5 2\\r\\nb 6 4 4 6 7 1\\r\\n', 'output': ['YES\\r\\n']}, {'input': '7 7 2\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 1\\r\\na 1 4 1 3 5 7\\r\\nb 2 3 2 4 6\\r\\na 7 4 1 3 5 7\\r\\nb 4 3 2 4 6\\r\\n', 'output': ['NO\\r\\n']}, {'input': '7 7 2\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 1\\r\\na 1 4 1 3 5 7\\r\\nb 2 3 2 4 6\\r\\na 4 4 1 3 5 7\\r\\nb 4 3 2 4 6\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 20 10\\r\\n1 10\\r\\n5 10\\r\\n2 9\\r\\n2 6\\r\\n9 6\\r\\n3 9\\r\\n7 1\\r\\n10 5\\r\\n7 8\\r\\n8 7\\r\\n2 3\\r\\n9 6\\r\\n1 6\\r\\n5 3\\r\\n4 3\\r\\n3 7\\r\\n8 2\\r\\n6 4\\r\\n2 3\\r\\n4 1\\r\\nTjOMmYPRUY 7 3 1 3 9\\r\\nj 6 2 11 15\\r\\nBanBSrUA 4 2 19 20\\r\\ncSWZxzR 8 1 8\\r\\nzVoRlNgt 10 2 6 7\\r\\nWLGaq 1 3 10 13 17\\r\\nKahHtTDj 1 2 2 14\\r\\nrUFZmkpI 6 1 16\\r\\ni 4 3 4 5 12\\r\\nKLGiua 6 1 18\\r\\nWLGaq 10 0\\r\\ncSWZxzR 3 1 4\\r\\nj 2 3 8 13 17\\r\\nrUFZmkpI 7 2 1 19\\r\\nKahHtTDj 5 1 16\\r\\nKLGiua 6 2 2 12\\r\\nBanBSrUA 2 4 6 7 10 15\\r\\nTjOMmYPRUY 9 3 3 9 18\\r\\nzVoRlNgt 10 2 11 20\\r\\ni 2 2 5 14\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 10 10\\r\\n7 10\\r\\n1 2\\r\\n4 3\\r\\n7 4\\r\\n9 2\\r\\n8 7\\r\\n10 8\\r\\n6 10\\r\\n5 2\\r\\n6 10\\r\\nznkkxCkkxv 9 1 10\\r\\nP 5 1 7\\r\\nKOF 1 2 3 9\\r\\nwYtfFWkb 3 0\\r\\nZPJiebeu 9 1 6\\r\\ndgzAhKY 4 0\\r\\nayqPf 3 0\\r\\nxFSb 9 0\\r\\nreYnbMDm 10 1 1\\r\\nydSIPy 6 4 2 4 5 8\\r\\nKOF 10 1 4\\r\\nayqPf 7 1 7\\r\\nreYnbMDm 4 1 5\\r\\nwYtfFWkb 5 1 6\\r\\nznkkxCkkxv 9 2 1 9\\r\\nydSIPy 10 0\\r\\nP 10 1 8\\r\\ndgzAhKY 7 1 2\\r\\nZPJiebeu 8 1 3\\r\\nxFSb 7 1 10\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 8 5\\r\\n1 3\\r\\n4 2\\r\\n1 3\\r\\n4 2\\r\\n1 5\\r\\n5 3\\r\\n2 5\\r\\n2 5\\r\\nTaMmKIk 1 0\\r\\nvrLryIxio 1 3 1 6 5\\r\\nGFKONi 2 1 4\\r\\nTzRVfh 3 2 3 8\\r\\nqp 4 2 7 2\\r\\nTaMmKIk 1 2 7 4\\r\\nvrLryIxio 1 3 1 6 5\\r\\nTzRVfh 3 1 8\\r\\nqp 4 1 3\\r\\nGFKONi 4 1 2\\r\\n', 'output': ['YES\\r\\n']}, {'input': '10 9 10\\r\\n4 7\\r\\n4 8\\r\\n8 3\\r\\n9 2\\r\\n8 3\\r\\n8 1\\r\\n6 9\\r\\n4 7\\r\\n7 4\\r\\nznkkxCkkxv 1 2 3 6\\r\\nQlf 3 0\\r\\nKOF 5 2 1 8\\r\\ndgzAhKY 5 0\\r\\nwYtfFWkb 6 2 4 7\\r\\nLbYfZPhWd 9 0\\r\\nP 10 1 9\\r\\nZPJiebeu 10 1 5\\r\\nayqPf 10 0\\r\\nzmZLwuf 10 1 2\\r\\nwYtfFWkb 2 2 7 4\\r\\nQlf 3 1 2\\r\\nznkkxCkkxv 3 3 6 3 9\\r\\nKOF 5 0\\r\\ndgzAhKY 5 0\\r\\nLbYfZPhWd 9 0\\r\\nP 10 1 5\\r\\nZPJiebeu 10 0\\r\\nayqPf 10 0\\r\\nzmZLwuf 10 2 1 8\\r\\n', 'output': ['NO\\r\\n']}]","id":116} {"description":"In the town of Aalam-Aara (meaning the Light of the Earth), previously there was no crime, no criminals but as the time progressed, sins started creeping into the hearts of once righteous people. Seeking solution to the problem, some of the elders found that as long as the corrupted part of population was kept away from the uncorrupted part, the crimes could be stopped. So, they are trying to set up a compound where they can keep the corrupted people. To ensure that the criminals don't escape the compound, a watchtower needs to be set up, so that they can be watched.Since the people of Aalam-Aara aren't very rich, they met up with a merchant from some rich town who agreed to sell them a land-plot which has already a straight line fence AB along which a few points are set up where they can put up a watchtower. Your task is to help them find out the number of points on that fence where the tower can be put up, so that all the criminals can be watched from there. Only one watchtower can be set up. A criminal is watchable from the watchtower if the line of visibility from the watchtower to him doesn't cross the plot-edges at any point between him and the tower i.e. as shown in figure 1 below, points X, Y, C and A are visible from point B but the points E and D are not. Figure 1 Figure 2 Assume that the land plot is in the shape of a polygon and coordinate axes have been setup such that the fence AB is parallel to x-axis and the points where the watchtower can be set up are the integer points on the line. For example, in given figure 2, watchtower can be setup on any of five integer points on AB i.e. (4,\u20098), (5,\u20098), (6,\u20098), (7,\u20098) or (8,\u20098). You can assume that no three consecutive points are collinear and all the corner points other than A and B, lie towards same side of fence AB. The given polygon doesn't contain self-intersections.","input_specification":"The first line of the test case will consist of the number of vertices n (3\u2009\u2264\u2009n\u2009\u2264\u20091000). Next n lines will contain the coordinates of the vertices in the clockwise order of the polygon. On the i-th line are integers xi and yi (0\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009106) separated by a space. The endpoints of the fence AB are the first two points, (x1,\u2009y1) and (x2,\u2009y2).","output_specification":"Output consists of a single line containing the number of points where the watchtower can be set up.","notes":"NoteFigure 2 shows the first test case. All the points in the figure are watchable from any point on fence AB. Since, AB has 5 integer coordinates, so answer is 5.For case two, fence CD and DE are not completely visible, thus answer is 0.","sample_inputs":["5\n4 8\n8 8\n9 4\n4 0\n0 4","5\n4 8\n5 8\n5 4\n7 4\n2 2"],"sample_outputs":["5","0"],"src_uid":"1503f0379bf8d7f25c191ddea9278842","lang_cluster":"Java","difficulty":2500,"human_solution":"import java.util.Scanner;\n\npublic class CF67E {\n\tstatic int[] x, y;\n\t\n\tstatic long cross(int i, int j, int k) {\n\t\tlong x1=x[j] - x[i];\n\t\tlong x2=x[k] - x[i];\n\t\tlong y1=y[j] - y[i];\n\t\tlong y2=y[k] - y[i];\n\t\treturn x1 * y2 - x2 * y1;\n\t}\n\t\n\t\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tx = new int[n];\n\t\ty = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] = sc.nextInt();\n\t\t\ty[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tboolean flip = x[0] < x[1];\n\t\tint X = x[1], Y = y[1];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tx[i] -= X;\n\t\t\ty[i] -= Y;\n\t\t\tif (flip) {\n\t\t\t\tx[i] = -x[i];\n\t\t\t\ty[i] = -y[i];\n\t\t\t}\n\t\t}\n\t\t\n\t\tint l = 0, r = x[0];\n\t\tfor (int i = 2; i + 1 < n; i++) {\n\t\t\tlong cr = cross(i, i + 1, 0);\n\t\t\tlong cl = cross(i, i + 1, 1);\n\t\t\tif (cr > 0 && cl > 0) {\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tint x0 = x[i], y0 = y[i], x1 = x[i + 1], y1 = y[i + 1];\n\t\t\tif (cr > 0 || cl > 0) {\n\t\t\t\tlong p = (long) x0 * (y1 - y0) - (long) y0 * (x1 - x0);\n\t\t\t\tlong q = y1 - y0;\n\t\t\t\tif (q < 0) {\n\t\t\t\t\tp = -p; q = -q;\n\t\t\t\t}\n\t\t\t\tif (cr > 0)\n\t\t\t\t\tr = Math.min(r, (int) (p \/ q));\n\t\t\t\telse\n\t\t\t\t\tl = Math.max(l, (int) ((p + q - 1) \/ q));\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(l <= r ? r - l + 1 : 0);\n\t\t\n\t}\t\n}\n\n","testcases":"[{'input': '5\\r\\n4 8\\r\\n8 8\\r\\n9 4\\r\\n4 0\\r\\n0 4\\r\\n', 'output': ['5\\r\\n']}, {'input': '5\\r\\n4 8\\r\\n5 8\\r\\n5 4\\r\\n7 4\\r\\n2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 4\\r\\n5 4\\r\\n2 0\\r\\n', 'output': ['6\\r\\n']}, {'input': '4\\r\\n0 4\\r\\n5 4\\r\\n5 0\\r\\n0 0\\r\\n', 'output': ['6\\r\\n']}, {'input': '4\\r\\n100 200\\r\\n800 200\\r\\n500 100\\r\\n100 0\\r\\n', 'output': ['701\\r\\n']}, {'input': '5\\r\\n0 4\\r\\n5 4\\r\\n2 2\\r\\n4 0\\r\\n0 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n2 5\\r\\n5 5\\r\\n4 4\\r\\n5 3\\r\\n0 0\\r\\n', 'output': ['2\\r\\n']}, {'input': '6\\r\\n1 9\\r\\n10 9\\r\\n11 7\\r\\n9 5\\r\\n5 7\\r\\n1 0\\r\\n', 'output': ['6\\r\\n']}, {'input': '6\\r\\n1 9\\r\\n10 9\\r\\n5 7\\r\\n11 7\\r\\n9 5\\r\\n1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n10 150\\r\\n90 150\\r\\n10 15\\r\\n', 'output': ['81\\r\\n']}, {'input': '5\\r\\n0 100\\r\\n50 100\\r\\n50 99\\r\\n149 0\\r\\n0 0\\r\\n', 'output': ['50\\r\\n']}, {'input': '10\\r\\n1000 0\\r\\n100 0\\r\\n0 25\\r\\n100 50\\r\\n100 51\\r\\n99 102\\r\\n1001 102\\r\\n1000 51\\r\\n1000 50\\r\\n1100 25\\r\\n', 'output': ['899\\r\\n']}, {'input': '6\\r\\n1 1000000\\r\\n999999 1000000\\r\\n519023 50000\\r\\n520013 500\\r\\n300033 50\\r\\n400023 500000\\r\\n', 'output': ['1\\r\\n']}, {'input': '8\\r\\n100 100\\r\\n10 100\\r\\n0 200\\r\\n5 400\\r\\n20 800\\r\\n16 801\\r\\n50 900\\r\\n110 300\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n588523 0\\r\\n411477 0\\r\\n400000 86602\\r\\n', 'output': ['177047\\r\\n']}, {'input': '15\\r\\n507852 0\\r\\n492148 0\\r\\n489545 9858\\r\\n489631 11995\\r\\n490865 14012\\r\\n491570 15795\\r\\n492996 17376\\r\\n495001 18605\\r\\n496671 19452\\r\\n498570 19850\\r\\n500373 19859\\r\\n502484 19363\\r\\n505000 18605\\r\\n506393 17344\\r\\n507857 15808\\r\\n', 'output': ['15705\\r\\n']}, {'input': '4\\r\\n889308 0\\r\\n110692 0\\r\\n0 461939\\r\\n146447 815492\\r\\n', 'output': ['778617\\r\\n']}, {'input': '5\\r\\n785915 0\\r\\n214085 0\\r\\n40939 436592\\r\\n128612 706421\\r\\n358143 873184\\r\\n', 'output': ['571831\\r\\n']}, {'input': '5\\r\\n999990 0\\r\\n0 0\\r\\n0 1000000\\r\\n1000000 1000000\\r\\n500000 50000\\r\\n', 'output': ['473685\\r\\n']}, {'input': '8\\r\\n3 0\\r\\n0 0\\r\\n0 1\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n2 1\\r\\n3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '6\\r\\n1 4\\r\\n3 4\\r\\n2 2\\r\\n1 1\\r\\n2 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n999998 999999\\r\\n1000000 999999\\r\\n0 0\\r\\n', 'output': ['3\\r\\n']}, {'input': '4\\r\\n999998 999999\\r\\n1000000 999999\\r\\n1 1\\r\\n0 0\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n500944 0\\r\\n499056 0\\r\\n498479 979\\r\\n498437 1288\\r\\n499191 1574\\r\\n499413 1796\\r\\n499300 1937\\r\\n500000 1987\\r\\n499995 1934\\r\\n500587 1796\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 4\\r\\n3 4\\r\\n2 2\\r\\n2 0\\r\\n0 0\\r\\n', 'output': ['3\\r\\n']}, {'input': '6\\r\\n4 0\\r\\n0 0\\r\\n2 2\\r\\n3 4\\r\\n2 5\\r\\n4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n0 5\\r\\n3 5\\r\\n2 3\\r\\n2 2\\r\\n1 2\\r\\n2 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n10 0\\r\\n0 0\\r\\n2 2\\r\\n1 3\\r\\n1 6\\r\\n', 'output': ['7\\r\\n']}, {'input': '8\\r\\n0 6\\r\\n5 6\\r\\n5 4\\r\\n3 4\\r\\n3 2\\r\\n5 2\\r\\n5 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n0 6\\r\\n5 6\\r\\n5 4\\r\\n3 4\\r\\n3 2\\r\\n5 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n1000000 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n999999 0\\r\\n0 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n999998 0\\r\\n0 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '6\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n2 999998\\r\\n1000000 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n999999 0\\r\\n0 0\\r\\n999999 999998\\r\\n1 1\\r\\n1000000 1000000\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n5 6\\r\\n7 6\\r\\n8 2\\r\\n6 2\\r\\n7 3\\r\\n6 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n7 8\\r\\n5 8\\r\\n4 12\\r\\n6 12\\r\\n5 11\\r\\n6 10\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n5 6\\r\\n12 6\\r\\n8 2\\r\\n6 2\\r\\n7 3\\r\\n6 4\\r\\n', 'output': ['3\\r\\n']}, {'input': '6\\r\\n10 12\\r\\n24 12\\r\\n16 4\\r\\n12 4\\r\\n14 6\\r\\n12 8\\r\\n', 'output': ['5\\r\\n']}]","id":117} {"description":"Anton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a new game. Vova suggested to them to play a game under the code name \"dot\" with the following rules: On the checkered paper a coordinate system is drawn. A dot is initially put in the position (x,\u2009y). A move is shifting a dot to one of the pre-selected vectors. Also each player can once per game symmetrically reflect a dot relatively to the line y\u2009=\u2009x. Anton and Dasha take turns. Anton goes first. The player after whose move the distance from the dot to the coordinates' origin exceeds d, loses. Help them to determine the winner.","input_specification":"The first line of the input file contains 4 integers x, y, n, d (\u2009-\u2009200\u2009\u2264\u2009x,\u2009y\u2009\u2264\u2009200,\u20091\u2009\u2264\u2009d\u2009\u2264\u2009200,\u20091\u2009\u2264\u2009n\u2009\u2264\u200920) \u2014 the initial coordinates of the dot, the distance d and the number of vectors. It is guaranteed that the initial dot is at the distance less than d from the origin of the coordinates. The following n lines each contain two non-negative numbers xi and yi (0\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009200) \u2014 the coordinates of the i-th vector. It is guaranteed that all the vectors are nonzero and different.","output_specification":"You should print \"Anton\", if the winner is Anton in case of both players play the game optimally, and \"Dasha\" otherwise.","notes":"NoteIn the first test, Anton goes to the vector (1;2), and Dasha loses. In the second test Dasha with her first move shifts the dot so that its coordinates are (2;3), and Anton loses, as he has the only possible move \u2014 to reflect relatively to the line y\u2009=\u2009x. Dasha will respond to it with the same move and return the dot in position (2;3).","sample_inputs":["0 0 2 3\n1 1\n1 2","0 0 2 4\n1 1\n1 2"],"sample_outputs":["Anton","Dasha"],"src_uid":"645a6ca9a8dda6946c2cc055a4beb08f","lang_cluster":"Java","difficulty":1900,"human_solution":"\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\npublic class Dot {\n\n static int N, D;\n static int[] vx, vy;\n static Boolean[][][][] dp;\n\n static long sq(long x) {\n\treturn x * x;\n }\n\n static boolean solve(int p1, int p2, int x, int y) {\n\tif (sq(x) + sq(y) > sq(D))\n\t return true;\n\tif (dp[p1][p2][x + 200][y + 200] != null)\n\t return dp[p1][p2][x + 200][y + 200];\n\tboolean ans = false;\n\tif (p1 == 0)\n\t ans |= !solve(p2, 1, y, x);\n\tfor (int i = 0; i < N; i++)\n\t ans |= !solve(p2, p1, x + vx[i], y + vy[i]);\n\treturn dp[p1][p2][x + 200][y + 200] = ans;\n }\n\n public static void main(String[] args) throws IOException {\n\tMyScanner sc = new MyScanner(System.in);\n\tPrintWriter out = new PrintWriter(System.out);\n\tint x = sc.nextInt(), y = sc.nextInt();\n\tN = sc.nextInt();\n\tD = sc.nextInt();\n\tvx = new int[N];\n\tvy = new int[N];\n\tfor (int i = 0; i < N; i++) {\n\t vx[i] = sc.nextInt();\n\t vy[i] = sc.nextInt();\n\t}\n\tdp = new Boolean[2][2][402][402];\n\tout.println(solve(0, 0, x, y) ? \"Anton\" : \"Dasha\");\n\tout.flush();\n\tout.close();\n }\n\n static class MyScanner {\n\n\tBufferedReader br;\n\tStringTokenizer st;\n\n\tMyScanner(InputStream is) {\n\t br = new BufferedReader(new InputStreamReader(is));\n\t}\n\n\tString next() throws IOException {\n\t while (st == null || !st.hasMoreTokens())\n\t\tst = new StringTokenizer(br.readLine());\n\t return st.nextToken();\n\t}\n\n\tint nextInt() throws IOException {\n\t return Integer.parseInt(next());\n\t}\n\n\tlong nextLong() throws IOException {\n\t return Long.parseLong(next());\n\t}\n\n\tboolean ready() throws IOException {\n\t return br.ready();\n\t}\n }\n}\n","testcases":"[{'input': '0 0 2 3\\r\\n1 1\\r\\n1 2\\r\\n', 'output': ['Anton']}, {'input': '0 0 2 4\\r\\n1 1\\r\\n1 2\\r\\n', 'output': ['Dasha']}, {'input': '0 0 5 100\\r\\n12 105\\r\\n15 59\\r\\n21 1\\r\\n27 6\\r\\n27 76\\r\\n', 'output': ['Anton']}, {'input': '0 0 5 100\\r\\n16 24\\r\\n29 6\\r\\n44 24\\r\\n66 37\\r\\n102 19\\r\\n', 'output': ['Anton']}, {'input': '0 0 5 100\\r\\n4 108\\r\\n5 170\\r\\n7 30\\r\\n7 101\\r\\n21 117\\r\\n', 'output': ['Anton']}, {'input': '0 0 5 100\\r\\n30 9\\r\\n53 14\\r\\n84 7\\r\\n94 18\\r\\n121 16\\r\\n', 'output': ['Anton']}, {'input': '0 0 5 100\\r\\n52 144\\r\\n55 58\\r\\n56 103\\r\\n98 65\\r\\n134 16\\r\\n', 'output': ['Anton']}, {'input': '0 0 5 100\\r\\n17 3\\r\\n42 24\\r\\n72 22\\r\\n72 25\\r\\n120 25\\r\\n', 'output': ['Dasha']}, {'input': '0 0 5 100\\r\\n21 38\\r\\n43 42\\r\\n59 29\\r\\n69 3\\r\\n84 52\\r\\n', 'output': ['Anton']}, {'input': '0 0 5 100\\r\\n2 164\\r\\n23 107\\r\\n30 167\\r\\n46 178\\r\\n66 148\\r\\n', 'output': ['Dasha']}, {'input': '3 -1 20 200\\r\\n2 27\\r\\n12 61\\r\\n14 76\\r\\n16 20\\r\\n19 72\\r\\n20 22\\r\\n30 27\\r\\n39 61\\r\\n42 44\\r\\n45 8\\r\\n46 23\\r\\n57 13\\r\\n62 56\\r\\n64 67\\r\\n80 30\\r\\n94 34\\r\\n94 77\\r\\n100 36\\r\\n101 13\\r\\n107 9\\r\\n', 'output': ['Anton']}, {'input': '3 -1 20 200\\r\\n1 139\\r\\n8 76\\r\\n10 97\\r\\n25 99\\r\\n26 147\\r\\n29 51\\r\\n48 79\\r\\n56 164\\r\\n67 80\\r\\n71 35\\r\\n89 90\\r\\n108 16\\r\\n108 127\\r\\n127 54\\r\\n137 13\\r\\n140 156\\r\\n146 104\\r\\n160 155\\r\\n164 138\\r\\n172 102\\r\\n', 'output': ['Anton']}, {'input': '3 -1 20 200\\r\\n1 28\\r\\n9 80\\r\\n20 92\\r\\n29 82\\r\\n38 65\\r\\n42 9\\r\\n50 65\\r\\n67 57\\r\\n71 60\\r\\n73 51\\r\\n78 89\\r\\n86 31\\r\\n90 39\\r\\n97 96\\r\\n104 27\\r\\n115 49\\r\\n119 59\\r\\n125 18\\r\\n132 37\\r\\n133 9\\r\\n', 'output': ['Anton']}, {'input': '3 -1 20 200\\r\\n3 51\\r\\n6 75\\r\\n7 105\\r\\n8 109\\r\\n12 59\\r\\n12 90\\r\\n15 71\\r\\n17 150\\r\\n18 161\\r\\n19 106\\r\\n23 71\\r\\n26 68\\r\\n34 95\\r\\n36 47\\r\\n38 29\\r\\n38 153\\r\\n41 91\\r\\n43 128\\r\\n43 164\\r\\n44 106\\r\\n', 'output': ['Anton']}, {'input': '3 -1 20 200\\r\\n19 12\\r\\n24 121\\r\\n25 32\\r\\n28 19\\r\\n28 87\\r\\n29 49\\r\\n32 88\\r\\n33 70\\r\\n37 77\\r\\n54 33\\r\\n56 27\\r\\n61 59\\r\\n67 42\\r\\n73 15\\r\\n76 40\\r\\n80 73\\r\\n83 39\\r\\n91 34\\r\\n91 112\\r\\n95 95\\r\\n', 'output': ['Anton']}, {'input': '-3 -14 20 200\\r\\n6 90\\r\\n7 12\\r\\n15 24\\r\\n16 67\\r\\n26 35\\r\\n34 63\\r\\n35 48\\r\\n36 30\\r\\n48 28\\r\\n56 35\\r\\n59 91\\r\\n60 34\\r\\n76 43\\r\\n77 90\\r\\n77 95\\r\\n79 34\\r\\n87 69\\r\\n93 6\\r\\n99 10\\r\\n99 41\\r\\n', 'output': ['Anton']}, {'input': '-3 -14 20 200\\r\\n5 54\\r\\n10 62\\r\\n20 43\\r\\n20 79\\r\\n21 47\\r\\n32 75\\r\\n33 48\\r\\n40 61\\r\\n44 65\\r\\n52 7\\r\\n52 28\\r\\n55 65\\r\\n55 67\\r\\n59 78\\r\\n68 52\\r\\n70 20\\r\\n71 72\\r\\n76 50\\r\\n90 100\\r\\n99 9\\r\\n', 'output': ['Dasha']}, {'input': '-3 -14 20 200\\r\\n1 60\\r\\n5 47\\r\\n10 6\\r\\n14 17\\r\\n14 32\\r\\n34 93\\r\\n40 9\\r\\n43 85\\r\\n44 47\\r\\n49 59\\r\\n57 85\\r\\n68 50\\r\\n69 93\\r\\n71 42\\r\\n71 57\\r\\n73 5\\r\\n74 70\\r\\n83 41\\r\\n83 83\\r\\n89 8\\r\\n', 'output': ['Anton']}, {'input': '-3 -14 20 200\\r\\n14 51\\r\\n26 54\\r\\n30 50\\r\\n38 41\\r\\n40 68\\r\\n47 12\\r\\n50 86\\r\\n63 4\\r\\n65 52\\r\\n67 83\\r\\n70 88\\r\\n71 61\\r\\n79 82\\r\\n82 53\\r\\n89 84\\r\\n90 16\\r\\n92 79\\r\\n97 37\\r\\n100 37\\r\\n100 93\\r\\n', 'output': ['Dasha']}, {'input': '-3 -14 20 200\\r\\n11 24\\r\\n13 8\\r\\n14 8\\r\\n15 44\\r\\n15 54\\r\\n20 79\\r\\n24 72\\r\\n27 7\\r\\n28 6\\r\\n30 18\\r\\n46 34\\r\\n51 5\\r\\n64 83\\r\\n69 48\\r\\n78 76\\r\\n79 2\\r\\n89 43\\r\\n92 31\\r\\n94 76\\r\\n99 64\\r\\n', 'output': ['Anton']}, {'input': '12 -11 20 200\\r\\n12 147\\r\\n14 181\\r\\n14 198\\r\\n33 51\\r\\n34 93\\r\\n43 29\\r\\n47 44\\r\\n56 161\\r\\n66 111\\r\\n96 119\\r\\n102 71\\r\\n117 184\\r\\n133 69\\r\\n151 189\\r\\n152 28\\r\\n173 27\\r\\n173 120\\r\\n176 12\\r\\n183 1\\r\\n188 196\\r\\n', 'output': ['Anton']}, {'input': '12 -11 20 200\\r\\n6 108\\r\\n14 188\\r\\n23 60\\r\\n28 44\\r\\n35 151\\r\\n36 82\\r\\n58 49\\r\\n65 81\\r\\n97 100\\r\\n104 26\\r\\n114 143\\r\\n136 156\\r\\n139 112\\r\\n142 119\\r\\n147 184\\r\\n148 46\\r\\n149 152\\r\\n175 178\\r\\n184 85\\r\\n187 12\\r\\n', 'output': ['Anton']}, {'input': '12 -11 20 200\\r\\n11 189\\r\\n12 108\\r\\n19 190\\r\\n21 27\\r\\n24 193\\r\\n26 86\\r\\n26 123\\r\\n31 180\\r\\n39 196\\r\\n107 193\\r\\n122 46\\r\\n129 103\\r\\n131 129\\r\\n132 135\\r\\n142 51\\r\\n157 22\\r\\n161 27\\r\\n195 163\\r\\n198 55\\r\\n199 64\\r\\n', 'output': ['Anton']}, {'input': '12 -11 20 200\\r\\n8 176\\r\\n11 162\\r\\n25 130\\r\\n32 124\\r\\n58 175\\r\\n59 170\\r\\n61 98\\r\\n66 37\\r\\n78 5\\r\\n87 150\\r\\n94 172\\r\\n99 171\\r\\n121 11\\r\\n121 31\\r\\n124 172\\r\\n131 71\\r\\n134 190\\r\\n162 50\\r\\n182 99\\r\\n194 119\\r\\n', 'output': ['Anton']}, {'input': '12 -11 20 200\\r\\n6 80\\r\\n12 62\\r\\n14 15\\r\\n16 133\\r\\n41 28\\r\\n43 47\\r\\n79 136\\r\\n90 196\\r\\n99 151\\r\\n99 187\\r\\n119 42\\r\\n121 11\\r\\n147 132\\r\\n149 166\\r\\n161 102\\r\\n174 4\\r\\n182 122\\r\\n194 50\\r\\n200 182\\r\\n200 197\\r\\n', 'output': ['Anton']}, {'input': '0 0 19 27\\r\\n1 25\\r\\n11 3\\r\\n12 38\\r\\n27 52\\r\\n35 111\\r\\n36 51\\r\\n44 7\\r\\n45 106\\r\\n58 104\\r\\n63 108\\r\\n75 4\\r\\n76 84\\r\\n89 2\\r\\n89 44\\r\\n92 23\\r\\n98 66\\r\\n111 58\\r\\n113 9\\r\\n114 76\\r\\n', 'output': ['Anton']}, {'input': '0 0 15 98\\r\\n5 14\\r\\n9 133\\r\\n10 128\\r\\n15 140\\r\\n17 53\\r\\n33 43\\r\\n50 15\\r\\n69 55\\r\\n74 134\\r\\n77 100\\r\\n99 82\\r\\n100 140\\r\\n102 12\\r\\n110 65\\r\\n128 110\\r\\n', 'output': ['Anton']}, {'input': '0 0 19 34\\r\\n0 116\\r\\n6 11\\r\\n6 32\\r\\n9 84\\r\\n14 3\\r\\n27 85\\r\\n42 58\\r\\n46 31\\r\\n52 104\\r\\n65 83\\r\\n66 37\\r\\n68 130\\r\\n69 69\\r\\n78 7\\r\\n78 23\\r\\n81 66\\r\\n90 27\\r\\n91 39\\r\\n96 10\\r\\n', 'output': ['Anton']}, {'input': '0 0 17 141\\r\\n9 30\\r\\n9 55\\r\\n11 64\\r\\n18 37\\r\\n20 94\\r\\n23 37\\r\\n23 140\\r\\n28 134\\r\\n36 43\\r\\n38 77\\r\\n50 47\\r\\n54 42\\r\\n70 32\\r\\n74 151\\r\\n85 68\\r\\n87 53\\r\\n88 91\\r\\n', 'output': ['Anton']}, {'input': '0 0 17 160\\r\\n31 75\\r\\n32 149\\r\\n49 132\\r\\n54 98\\r\\n54 100\\r\\n57 48\\r\\n65 20\\r\\n67 177\\r\\n72 76\\r\\n74 25\\r\\n99 49\\r\\n105 86\\r\\n128 116\\r\\n147 176\\r\\n156 130\\r\\n160 26\\r\\n178 177\\r\\n', 'output': ['Anton']}, {'input': '-100 -100 10 200\\r\\n0 1\\r\\n1 0\\r\\n1 1\\r\\n31 41\\r\\n3 4\\r\\n5 2\\r\\n1 2\\r\\n3 3\\r\\n9 8\\r\\n10 2\\r\\n', 'output': ['Anton']}, {'input': '-140 -140 2 200\\r\\n1 0\\r\\n0 1\\r\\n', 'output': ['Dasha']}, {'input': '-130 -130 20 200\\r\\n0 1\\r\\n1 0\\r\\n1 1\\r\\n31 41\\r\\n3 4\\r\\n5 2\\r\\n1 2\\r\\n3 3\\r\\n9 8\\r\\n10 2\\r\\n0 2\\r\\n0 3\\r\\n0 4\\r\\n0 5\\r\\n0 6\\r\\n2 0\\r\\n3 0\\r\\n4 0\\r\\n5 0\\r\\n6 0\\r\\n', 'output': ['Anton']}, {'input': '-133 -133 20 200\\r\\n1 0\\r\\n0 1\\r\\n1 1\\r\\n2 0\\r\\n0 2\\r\\n2 1\\r\\n1 2\\r\\n3 0\\r\\n0 3\\r\\n3 1\\r\\n3 2\\r\\n3 3\\r\\n2 2\\r\\n2 3\\r\\n1 3\\r\\n4 0\\r\\n0 4\\r\\n4 1\\r\\n1 4\\r\\n2 4\\r\\n', 'output': ['Anton']}, {'input': '-12 -34 5 200\\r\\n1 0\\r\\n2 0\\r\\n3 1\\r\\n10 3\\r\\n11 4\\r\\n', 'output': ['Dasha']}]","id":118} {"description":"Once a walrus professor Plato asked his programming students to perform the following practical task. The students had to implement such a data structure that would support a convex hull on some set of points S. The input to the program had q queries of two types: 1. Add a point with coordinates (x,\u2009y) into the set S. Note that in this case the convex hull of S could have changed, and could have remained the same. 2. Say whether a point with coordinates (x,\u2009y) belongs to an area limited by the convex hull, including the border. All the students coped with the task. What about you?","input_specification":"The first line contains an integer q (4\u2009\u2264\u2009q\u2009\u2264\u2009105). Then follow q lines in the following way: \"t x y\", where t is the query type (1 or 2), and (x,\u2009y) are the coordinates of the point (\u2009-\u2009106\u2009\u2264\u2009x,\u2009y\u2009\u2264\u2009106, x and y are integers). There is at least one query of type 2. It is guaranteed that the three queries of the first type follow first and the points given in the queries form a non-degenerative triangle. Also all the points added in S are distinct.","output_specification":"For each query of the second type print one string containing \"YES\", if the point lies inside the convex hull or on its border. Otherwise, print \"NO\".","notes":null,"sample_inputs":["8\n1 0 0\n1 2 0\n1 2 2\n2 1 0\n1 0 2\n2 1 1\n2 2 1\n2 20 -1"],"sample_outputs":["YES\nYES\nYES\nNO"],"src_uid":"6220f4058f9325dfb211fb1dd86e9464","lang_cluster":"Java","difficulty":2700,"human_solution":"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.util.TreeSet;\n\npublic class ConvexHull {\n\n static class Point{\n int x;\n int y;\n Point(int x, int y){\n this.x = x;\n this.y = y;\n }\n }\n\n static long cross(Point a, Point b, Point c){\n return (long) (b.x - a.x) * (c.y - a.y) - (long) (b.y - a.y)*(c.x - a.x);\n }\n\n static boolean isItOut(Point a, Point b, Point c, boolean upper){\n if(a == null || b == null) {\n return true;\n }\n if(upper && (a == b && a.y < c.y || cross(a,b,c) > 0)){\n return true;\n }\n if(!upper && (a == b && a.y > c.y || cross(a,b,c) < 0)){\n return true;\n }\n return false;\n }\n\n static void removePoint(TreeSet t, Point p, boolean right, boolean upper){\n Point a = right ? t.ceiling(p) : t.floor(p);\n if(a == null){\n return;\n }\n if(a.x == p.x){\n t.remove(a);\n a = right ? t.ceiling(p) : t.floor(p);\n }\n if(a == null){\n return;\n }\n Point b = right ? t.higher(a) : t.lower(a);\n int sign = upper ? 1 : -1;\n sign = right ? sign * 1 : sign * -1;\n while(b != null && cross(p, a, b) * sign >= 0){\n\n t.remove(a);\n a = b;\n b = right ? t.higher(a) : t.lower(a);\n\n }\n }\n\n public static void main (String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int q = Integer.parseInt(br.readLine());\n \/\/upper hull\n TreeSet upper = new TreeSet<>((a,b) -> a.x - b.x);\n \/\/lower hull\n TreeSet lower = new TreeSet<>((a,b) -> a.x - b.x);\n\n while(q > 0){\n StringTokenizer st = new StringTokenizer(br.readLine());\n int t = Integer.parseInt(st.nextToken());\n int x = Integer.parseInt(st.nextToken());\n int y = Integer.parseInt(st.nextToken());\n Point p = new Point(x,y);\n Point ul = upper.floor(p);\n Point ur = upper.ceiling(p);\n Point ll = lower.floor(p);\n Point lr = lower.ceiling(p);\n\n boolean outupper = isItOut(ul, ur, p, true);\n boolean outlower = isItOut(ll, lr, p, false);\n\n if(t == 1){\n \/\/add to convex hull\n if(outupper){\n removePoint(upper, p, true, true);\n removePoint(upper, p, false, true);\n upper.add(p);\n }\n if(outlower){\n removePoint(lower, p, true, false);\n removePoint(lower, p, false, false);\n lower.add(p);\n }\n\n }else{\n \/\/see if in convex hull\n \/\/is it right or left?\n System.out.println(outupper || outlower ? \"NO\" : \"YES\");\n \/\/above top curve\n\n \/\/below bottom curve\n\n }\n \/\/Point[] up = upper.toArray();\n \/\/System.out.printf(\"UPPER: \");\n \/\/for(int i = 0; i < up.length; i ++){\n \/\/ System.out.printf(\"%d %d \", up[i].x, up[i].y);\n \/\/}\n\n \/\/Object[] low = lower.toArray();\n \/\/System.out.printf(\"\\nLOWER: \");\n \/\/for(int i = 0; i < low.length; i ++){\n \/\/ System.out.printf(\"%d %d \", low[i].x, low[i].y);\n \/\/}\n \/\/System.out.println();\n\n q--;\n }\n\n }\n\n}\n","testcases":"[{'input': '8\\r\\n1 0 0\\r\\n1 2 0\\r\\n1 2 2\\r\\n2 1 0\\r\\n1 0 2\\r\\n2 1 1\\r\\n2 2 1\\r\\n2 20 -1\\r\\n', 'output': ['YES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 0 0\\r\\n1 5 0\\r\\n1 0 5\\r\\n2 1 1\\r\\n2 10 10\\r\\n1 2 10\\r\\n2 1 1\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '5\\r\\n1 2 -2\\r\\n1 -2 2\\r\\n1 1 5\\r\\n2 3 -1\\r\\n2 3 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\n']}, {'input': '5\\r\\n1 -1 0\\r\\n1 1 0\\r\\n1 0 2\\r\\n2 0 1\\r\\n2 0 3\\r\\n', 'output': ['YES\\r\\nNO\\r\\n']}, {'input': '6\\r\\n1 -2 0\\r\\n1 2 0\\r\\n1 0 2\\r\\n2 4 0\\r\\n2 1 0\\r\\n2 2 0\\r\\n', 'output': ['NO\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '11\\r\\n1 0 -1\\r\\n1 0 1\\r\\n1 1 -1\\r\\n1 -1 -5\\r\\n1 0 5\\r\\n2 5 1\\r\\n2 5 0\\r\\n2 5 -1\\r\\n2 0 0\\r\\n2 0 10\\r\\n2 0 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '30\\r\\n1 -37 889\\r\\n1 771 -764\\r\\n1 -119 938\\r\\n1 599 868\\r\\n1 56 161\\r\\n1 -67 86\\r\\n2 -692 99\\r\\n2 -995 158\\r\\n2 410 116\\r\\n1 -49 -864\\r\\n2 30 -580\\r\\n1 -930 454\\r\\n1 -706 301\\r\\n2 547 -606\\r\\n2 -252 -55\\r\\n2 662 152\\r\\n2 -621 -920\\r\\n1 -128 -595\\r\\n1 -401 -265\\r\\n1 434 388\\r\\n2 299 173\\r\\n1 104 -298\\r\\n1 -693 557\\r\\n2 840 -179\\r\\n2 382 -8\\r\\n1 461 618\\r\\n1 -928 628\\r\\n2 193 -972\\r\\n2 218 945\\r\\n2 490 571\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '30\\r\\n1 -619 -234\\r\\n1 -140 -846\\r\\n1 762 -792\\r\\n2 153 29\\r\\n1 -353 627\\r\\n2 -544 -418\\r\\n2 -922 -965\\r\\n1 -620 -692\\r\\n1 -34 295\\r\\n2 -326 -604\\r\\n2 -906 -867\\r\\n2 57 -690\\r\\n1 -87 -822\\r\\n2 -569 739\\r\\n2 -92 -927\\r\\n2 279 806\\r\\n1 -364 19\\r\\n2 -214 -629\\r\\n2 -283 662\\r\\n2 -324 650\\r\\n1 92 -511\\r\\n2 654 -597\\r\\n1 -87 747\\r\\n2 795 46\\r\\n2 870 -157\\r\\n2 -11 520\\r\\n1 -162 -686\\r\\n2 290 -660\\r\\n2 -660 780\\r\\n2 946 910\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '30\\r\\n1 -702 -823\\r\\n1 -330 -896\\r\\n1 -564 90\\r\\n1 559 818\\r\\n2 404 716\\r\\n1 -900 -379\\r\\n2 866 -218\\r\\n2 444 615\\r\\n2 -782 -887\\r\\n2 584 -919\\r\\n2 891 775\\r\\n1 117 887\\r\\n2 598 162\\r\\n2 759 -925\\r\\n2 713 -507\\r\\n1 -329 120\\r\\n2 546 185\\r\\n2 399 500\\r\\n1 -611 763\\r\\n1 -956 187\\r\\n2 82 -26\\r\\n2 -877 -906\\r\\n1 293 -637\\r\\n2 -685 -275\\r\\n2 -725 -927\\r\\n1 -627 777\\r\\n1 -609 -563\\r\\n2 402 54\\r\\n1 -106 -908\\r\\n2 175 808\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '30\\r\\n1 -64 -994\\r\\n1 -692 366\\r\\n1 -72 847\\r\\n2 -963 -251\\r\\n1 -651 -994\\r\\n1 -523 -861\\r\\n2 553 -129\\r\\n2 17 785\\r\\n2 -584 -880\\r\\n1 105 657\\r\\n1 649 98\\r\\n2 -572 -492\\r\\n1 -38 -481\\r\\n1 540 463\\r\\n1 -468 -540\\r\\n1 -730 100\\r\\n1 606 -119\\r\\n1 -254 -380\\r\\n1 169 280\\r\\n1 319 62\\r\\n1 452 -556\\r\\n1 -653 887\\r\\n1 407 -786\\r\\n2 -632 181\\r\\n1 925 -967\\r\\n2 996 -709\\r\\n1 568 517\\r\\n2 -478 76\\r\\n1 156 621\\r\\n2 -592 899\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '30\\r\\n1 836 -283\\r\\n1 299 629\\r\\n1 434 -481\\r\\n1 -500 -368\\r\\n2 -105 -216\\r\\n2 -617 443\\r\\n2 -579 811\\r\\n1 411 -242\\r\\n1 -652 41\\r\\n1 962 -483\\r\\n1 -732 579\\r\\n2 554 -147\\r\\n1 39 967\\r\\n1 917 -199\\r\\n2 686 397\\r\\n1 444 780\\r\\n1 278 462\\r\\n1 729 -18\\r\\n1 252 -864\\r\\n1 884 -952\\r\\n1 272 689\\r\\n2 366 -389\\r\\n1 443 924\\r\\n1 791 -249\\r\\n2 692 74\\r\\n2 -412 550\\r\\n2 506 -472\\r\\n2 -626 474\\r\\n1 -895 -42\\r\\n2 -390 -971\\r\\n', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '12\\r\\n1 0 0\\r\\n1 10 0\\r\\n1 8 1\\r\\n2 11 0\\r\\n1 2 0\\r\\n2 7 0\\r\\n2 9 0\\r\\n2 1 0\\r\\n1 1 1\\r\\n2 10 0\\r\\n2 9 0\\r\\n2 11 0\\r\\n', 'output': ['NO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 1 0\\r\\n1 3 0\\r\\n1 5000 5000\\r\\n2 3 0\\r\\n2 2 0\\r\\n2 4 0\\r\\n2 -1 0\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '4\\r\\n1 1 0\\r\\n1 3 0\\r\\n1 2 2\\r\\n2 4 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4\\r\\n1 1 0\\r\\n1 3 0\\r\\n1 0 8\\r\\n2 4 0\\r\\n', 'output': ['NO\\r\\n']}, {'input': '11\\r\\n1 0 -1\\r\\n1 0 1\\r\\n1 -1 -5\\r\\n1 6 4\\r\\n1 -8 8\\r\\n2 6 -1\\r\\n2 6 1\\r\\n2 1 0\\r\\n2 1 -1\\r\\n2 1 1\\r\\n2 6 0\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '11\\r\\n1 5 4\\r\\n1 5 6\\r\\n1 4 0\\r\\n1 11 9\\r\\n1 -3 13\\r\\n2 11 4\\r\\n2 11 6\\r\\n2 6 5\\r\\n2 6 4\\r\\n2 6 6\\r\\n2 11 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -2 -1000000\\r\\n1 -1 -1000000\\r\\n1 -1 -999999\\r\\n1 1 1000000\\r\\n1 -231100 1000000\\r\\n2 0 0\\r\\n2 1 999999\\r\\n', 'output': ['YES\\r\\nNO\\r\\n']}, {'input': '10\\r\\n1 -1000000 -1000000\\r\\n1 -999999 -1000000\\r\\n1 999999 1000000\\r\\n1 1000000 1000000\\r\\n2 0 0\\r\\n2 1000000 999999\\r\\n2 999999 1000000\\r\\n2 999999 999999\\r\\n2 999999 999998\\r\\n2 999999 999997\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '9\\r\\n1 -2 -4\\r\\n1 2 4\\r\\n1 -3 3\\r\\n2 -1 -2\\r\\n2 -4 -8\\r\\n2 -3 -6\\r\\n2 1 2\\r\\n2 4 8\\r\\n2 3 6\\r\\n', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '16\\r\\n1 -10000 0\\r\\n1 10000 0\\r\\n1 0 -1\\r\\n2 50000 0\\r\\n2 -50000 0\\r\\n2 49000 0\\r\\n2 -49000 0\\r\\n2 27000 0\\r\\n2 -27000 0\\r\\n1 0 1\\r\\n2 50000 0\\r\\n2 -50000 0\\r\\n2 49000 0\\r\\n2 -49000 0\\r\\n2 27000 0\\r\\n2 -27000 0\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -7000 -9000\\r\\n1 7000 9000\\r\\n1 7000 -7000\\r\\n2 21 27\\r\\n2 -21 -27\\r\\n2 7007 9009\\r\\n2 -7007 -9009\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -7000 -9000\\r\\n1 7000 9000\\r\\n1 -7000 7000\\r\\n2 21 27\\r\\n2 -21 -27\\r\\n2 7007 9009\\r\\n2 -7007 -9009\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -9000 7000\\r\\n1 9000 -7000\\r\\n1 7000 7000\\r\\n2 -27 21\\r\\n2 27 -21\\r\\n2 -9009 7007\\r\\n2 9009 -7007\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '7\\r\\n1 -9000 7000\\r\\n1 9000 -7000\\r\\n1 -7000 -7000\\r\\n2 -27 21\\r\\n2 27 -21\\r\\n2 -9009 7007\\r\\n2 9009 -7007\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 7 6\\r\\n1 0 5\\r\\n1 0 4\\r\\n1 2 5\\r\\n1 8 0\\r\\n1 6 4\\r\\n1 1 1\\r\\n1 8 4\\r\\n2 1 1\\r\\n2 2 7\\r\\n1 2 3\\r\\n1 4 2\\r\\n2 4 3\\r\\n1 3 2\\r\\n1 7 2\\r\\n1 1 0\\r\\n2 3 5\\r\\n1 6 5\\r\\n2 5 7\\r\\n2 1 1\\r\\n2 3 2\\r\\n1 6 2\\r\\n2 6 0\\r\\n2 8 8\\r\\n1 4 6\\r\\n1 3 5\\r\\n2 3 8\\r\\n2 0 5\\r\\n2 1 6\\r\\n1 8 3\\r\\n1 2 2\\r\\n1 8 2\\r\\n1 6 8\\r\\n1 1 3\\r\\n1 3 3\\r\\n1 5 5\\r\\n2 2 0\\r\\n2 6 7\\r\\n2 1 6\\r\\n2 6 4\\r\\n', 'output': ['YES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 3 8\\r\\n1 6 7\\r\\n1 7 7\\r\\n2 5 5\\r\\n1 4 0\\r\\n1 0 0\\r\\n2 7 3\\r\\n1 0 2\\r\\n2 8 2\\r\\n2 5 1\\r\\n2 1 2\\r\\n2 1 5\\r\\n1 1 3\\r\\n1 7 1\\r\\n1 8 7\\r\\n1 2 4\\r\\n1 2 8\\r\\n2 8 5\\r\\n2 8 6\\r\\n1 2 1\\r\\n1 5 6\\r\\n1 2 3\\r\\n2 4 3\\r\\n1 8 3\\r\\n1 1 5\\r\\n2 2 2\\r\\n2 8 5\\r\\n1 0 7\\r\\n1 7 2\\r\\n1 5 5\\r\\n1 8 4\\r\\n1 4 1\\r\\n2 3 2\\r\\n2 6 0\\r\\n2 8 7\\r\\n2 5 7\\r\\n1 3 0\\r\\n2 1 0\\r\\n2 0 7\\r\\n2 5 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 8\\r\\n1 3 8\\r\\n1 7 4\\r\\n1 4 5\\r\\n1 4 1\\r\\n2 6 6\\r\\n2 5 8\\r\\n1 5 4\\r\\n1 7 8\\r\\n2 1 3\\r\\n2 6 1\\r\\n2 8 2\\r\\n2 6 8\\r\\n1 4 3\\r\\n2 2 8\\r\\n2 0 6\\r\\n1 0 3\\r\\n2 0 3\\r\\n1 6 6\\r\\n1 5 8\\r\\n1 5 5\\r\\n1 1 2\\r\\n2 6 7\\r\\n1 4 8\\r\\n2 1 2\\r\\n2 2 7\\r\\n2 2 3\\r\\n1 8 4\\r\\n2 8 4\\r\\n2 6 5\\r\\n1 8 2\\r\\n2 7 2\\r\\n2 3 5\\r\\n1 4 0\\r\\n2 6 2\\r\\n2 3 7\\r\\n1 4 6\\r\\n1 8 6\\r\\n1 0 5\\r\\n2 2 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 4 0\\r\\n1 7 1\\r\\n1 8 0\\r\\n1 1 2\\r\\n1 1 8\\r\\n1 6 1\\r\\n2 5 2\\r\\n1 7 7\\r\\n1 6 5\\r\\n2 8 1\\r\\n2 8 7\\r\\n1 7 8\\r\\n2 3 5\\r\\n2 6 6\\r\\n1 4 2\\r\\n1 8 3\\r\\n2 6 8\\r\\n1 4 8\\r\\n2 4 6\\r\\n2 1 7\\r\\n1 4 3\\r\\n2 0 8\\r\\n1 5 2\\r\\n2 5 5\\r\\n2 1 6\\r\\n1 5 5\\r\\n1 1 5\\r\\n2 3 3\\r\\n2 0 1\\r\\n1 1 0\\r\\n2 1 4\\r\\n2 3 6\\r\\n1 4 6\\r\\n2 7 6\\r\\n1 4 4\\r\\n1 7 6\\r\\n1 6 8\\r\\n2 1 1\\r\\n1 0 1\\r\\n2 0 2\\r\\n', 'output': ['YES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 3 0\\r\\n1 1 4\\r\\n1 2 7\\r\\n2 4 0\\r\\n1 0 5\\r\\n1 7 5\\r\\n2 6 3\\r\\n1 0 7\\r\\n2 5 7\\r\\n1 1 0\\r\\n2 0 6\\r\\n1 6 8\\r\\n1 3 5\\r\\n1 8 5\\r\\n1 0 6\\r\\n2 7 0\\r\\n1 4 6\\r\\n1 5 2\\r\\n2 6 2\\r\\n1 7 0\\r\\n2 6 3\\r\\n1 3 7\\r\\n2 4 2\\r\\n2 1 4\\r\\n1 1 3\\r\\n1 5 0\\r\\n2 0 7\\r\\n2 6 8\\r\\n1 4 0\\r\\n2 5 0\\r\\n2 3 2\\r\\n2 6 7\\r\\n1 7 2\\r\\n1 0 3\\r\\n1 6 6\\r\\n2 4 0\\r\\n2 2 4\\r\\n1 6 5\\r\\n2 0 8\\r\\n2 0 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 0 3\\r\\n1 6 0\\r\\n1 8 7\\r\\n2 2 6\\r\\n2 7 2\\r\\n2 7 5\\r\\n1 4 7\\r\\n1 2 3\\r\\n2 2 7\\r\\n2 3 1\\r\\n1 3 5\\r\\n1 8 5\\r\\n2 6 8\\r\\n1 2 8\\r\\n2 4 6\\r\\n1 7 3\\r\\n1 3 3\\r\\n2 2 4\\r\\n1 5 0\\r\\n1 5 6\\r\\n1 1 7\\r\\n2 3 3\\r\\n1 8 6\\r\\n2 7 4\\r\\n1 7 8\\r\\n1 5 8\\r\\n2 3 8\\r\\n1 6 6\\r\\n2 8 5\\r\\n1 5 1\\r\\n2 4 2\\r\\n1 7 7\\r\\n2 4 8\\r\\n1 6 1\\r\\n1 1 5\\r\\n2 1 8\\r\\n2 4 3\\r\\n1 5 5\\r\\n1 4 0\\r\\n2 0 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 5 2\\r\\n1 5 6\\r\\n1 2 1\\r\\n2 7 2\\r\\n2 6 2\\r\\n2 0 8\\r\\n2 0 6\\r\\n1 6 8\\r\\n1 2 0\\r\\n1 0 5\\r\\n2 3 0\\r\\n1 3 8\\r\\n2 8 6\\r\\n1 0 3\\r\\n1 8 8\\r\\n2 1 1\\r\\n1 1 4\\r\\n1 1 3\\r\\n2 0 0\\r\\n2 5 6\\r\\n1 0 0\\r\\n2 0 0\\r\\n1 2 7\\r\\n2 0 0\\r\\n2 3 6\\r\\n1 3 3\\r\\n1 3 2\\r\\n1 5 3\\r\\n1 7 8\\r\\n1 7 4\\r\\n1 8 7\\r\\n1 7 3\\r\\n2 0 3\\r\\n1 4 4\\r\\n2 5 0\\r\\n1 6 6\\r\\n1 8 0\\r\\n2 6 2\\r\\n2 4 8\\r\\n2 7 2\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 4\\r\\n1 1 5\\r\\n1 3 5\\r\\n2 8 2\\r\\n2 5 2\\r\\n1 7 3\\r\\n1 8 1\\r\\n2 6 5\\r\\n1 4 3\\r\\n1 2 4\\r\\n1 2 3\\r\\n2 8 3\\r\\n2 3 5\\r\\n2 2 0\\r\\n1 6 7\\r\\n2 2 8\\r\\n1 3 0\\r\\n2 5 1\\r\\n2 2 1\\r\\n1 4 5\\r\\n2 1 6\\r\\n1 8 5\\r\\n2 7 4\\r\\n2 2 0\\r\\n1 3 2\\r\\n1 2 2\\r\\n1 8 3\\r\\n2 3 4\\r\\n1 7 6\\r\\n1 3 7\\r\\n1 5 3\\r\\n1 2 0\\r\\n2 5 7\\r\\n2 0 7\\r\\n2 3 2\\r\\n2 1 0\\r\\n1 6 0\\r\\n2 8 5\\r\\n1 3 4\\r\\n2 0 3\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '40\\r\\n1 8 7\\r\\n1 0 6\\r\\n1 5 0\\r\\n2 6 7\\r\\n2 6 8\\r\\n1 3 5\\r\\n1 6 7\\r\\n1 0 0\\r\\n2 1 7\\r\\n1 2 3\\r\\n2 4 3\\r\\n2 5 5\\r\\n1 4 7\\r\\n2 2 0\\r\\n1 2 4\\r\\n1 4 2\\r\\n1 0 8\\r\\n2 0 3\\r\\n1 8 8\\r\\n2 8 1\\r\\n2 8 6\\r\\n2 4 8\\r\\n1 4 0\\r\\n1 6 6\\r\\n2 0 0\\r\\n1 6 2\\r\\n2 5 1\\r\\n1 3 0\\r\\n1 5 6\\r\\n1 8 1\\r\\n1 3 4\\r\\n1 1 3\\r\\n1 5 1\\r\\n1 5 7\\r\\n1 6 8\\r\\n1 1 5\\r\\n1 1 1\\r\\n1 6 1\\r\\n1 1 4\\r\\n2 7 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 8\\r\\n1 4 0\\r\\n1 0 6\\r\\n2 3 8\\r\\n2 4 5\\r\\n1 5 0\\r\\n2 7 6\\r\\n2 6 1\\r\\n2 1 7\\r\\n1 1 2\\r\\n1 5 4\\r\\n1 7 3\\r\\n2 6 4\\r\\n1 3 0\\r\\n2 2 8\\r\\n1 8 2\\r\\n1 8 8\\r\\n1 7 8\\r\\n2 2 5\\r\\n2 2 3\\r\\n2 4 6\\r\\n2 0 2\\r\\n2 6 7\\r\\n2 2 8\\r\\n1 8 3\\r\\n2 5 5\\r\\n1 4 8\\r\\n1 7 1\\r\\n2 7 3\\r\\n2 4 5\\r\\n2 1 1\\r\\n2 4 2\\r\\n1 1 1\\r\\n2 4 0\\r\\n1 2 4\\r\\n2 7 0\\r\\n1 4 1\\r\\n1 7 5\\r\\n1 6 6\\r\\n2 7 8\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 6 3\\r\\n1 5 3\\r\\n1 3 4\\r\\n1 2 3\\r\\n2 2 5\\r\\n1 6 1\\r\\n2 3 7\\r\\n1 0 0\\r\\n1 8 7\\r\\n1 3 8\\r\\n1 0 8\\r\\n1 3 5\\r\\n1 4 5\\r\\n1 0 5\\r\\n2 8 1\\r\\n2 4 7\\r\\n2 3 2\\r\\n1 6 4\\r\\n2 2 3\\r\\n2 6 3\\r\\n1 0 2\\r\\n2 1 2\\r\\n2 6 2\\r\\n1 5 7\\r\\n2 7 0\\r\\n1 4 8\\r\\n1 4 6\\r\\n2 8 7\\r\\n2 0 7\\r\\n1 7 8\\r\\n2 0 3\\r\\n1 5 5\\r\\n1 6 2\\r\\n2 4 5\\r\\n1 2 5\\r\\n2 3 3\\r\\n2 1 1\\r\\n1 8 3\\r\\n1 6 5\\r\\n2 5 5\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 6 5\\r\\n1 4 8\\r\\n1 5 7\\r\\n1 3 1\\r\\n2 4 2\\r\\n1 4 3\\r\\n1 0 7\\r\\n2 4 6\\r\\n2 4 2\\r\\n1 0 3\\r\\n2 1 5\\r\\n2 5 6\\r\\n1 8 8\\r\\n1 1 7\\r\\n1 3 3\\r\\n2 6 7\\r\\n1 7 4\\r\\n1 0 2\\r\\n1 8 4\\r\\n2 4 5\\r\\n2 0 7\\r\\n1 4 1\\r\\n1 4 4\\r\\n1 5 3\\r\\n1 1 0\\r\\n1 4 5\\r\\n2 1 4\\r\\n1 0 6\\r\\n2 1 0\\r\\n1 5 5\\r\\n2 5 6\\r\\n2 8 2\\r\\n2 1 7\\r\\n2 8 1\\r\\n2 0 5\\r\\n1 0 4\\r\\n1 6 6\\r\\n2 1 1\\r\\n1 8 0\\r\\n2 6 3\\r\\n', 'output': ['NO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 7\\r\\n1 3 3\\r\\n1 6 5\\r\\n1 7 3\\r\\n1 2 8\\r\\n1 3 0\\r\\n2 0 0\\r\\n1 7 7\\r\\n2 6 8\\r\\n2 6 0\\r\\n2 4 7\\r\\n1 7 8\\r\\n2 0 7\\r\\n2 0 5\\r\\n1 6 2\\r\\n1 7 1\\r\\n1 1 1\\r\\n2 4 8\\r\\n2 2 1\\r\\n2 7 0\\r\\n2 5 4\\r\\n1 2 4\\r\\n2 1 3\\r\\n2 0 5\\r\\n2 5 5\\r\\n2 1 4\\r\\n2 5 5\\r\\n1 2 6\\r\\n1 4 4\\r\\n2 0 8\\r\\n1 0 6\\r\\n2 0 5\\r\\n2 4 6\\r\\n2 8 1\\r\\n2 2 0\\r\\n2 3 3\\r\\n1 0 4\\r\\n1 3 7\\r\\n2 3 2\\r\\n2 3 7\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 7\\r\\n1 6 5\\r\\n1 2 0\\r\\n2 4 5\\r\\n1 1 0\\r\\n2 3 4\\r\\n1 7 3\\r\\n2 8 1\\r\\n2 0 0\\r\\n2 2 0\\r\\n1 7 4\\r\\n1 6 3\\r\\n2 8 1\\r\\n2 6 0\\r\\n1 4 7\\r\\n2 4 2\\r\\n1 4 5\\r\\n2 3 7\\r\\n2 6 8\\r\\n2 2 6\\r\\n2 7 4\\r\\n1 0 6\\r\\n2 1 7\\r\\n1 4 4\\r\\n2 2 3\\r\\n1 1 3\\r\\n1 8 5\\r\\n1 0 5\\r\\n1 1 1\\r\\n1 4 3\\r\\n2 5 3\\r\\n1 3 6\\r\\n1 7 0\\r\\n2 5 6\\r\\n2 5 6\\r\\n1 0 7\\r\\n2 7 0\\r\\n2 6 4\\r\\n1 3 7\\r\\n2 2 2\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 4 4\\r\\n1 2 6\\r\\n1 8 2\\r\\n2 4 6\\r\\n1 5 4\\r\\n2 5 8\\r\\n2 6 7\\r\\n2 4 8\\r\\n1 1 0\\r\\n1 3 1\\r\\n1 0 3\\r\\n1 8 1\\r\\n1 3 0\\r\\n2 7 4\\r\\n1 2 0\\r\\n1 8 5\\r\\n1 6 2\\r\\n2 2 0\\r\\n1 0 4\\r\\n1 1 1\\r\\n1 4 5\\r\\n2 8 3\\r\\n2 1 0\\r\\n2 5 5\\r\\n1 3 4\\r\\n2 0 7\\r\\n1 4 3\\r\\n1 7 0\\r\\n2 3 8\\r\\n1 0 1\\r\\n1 0 7\\r\\n2 4 1\\r\\n1 0 6\\r\\n2 1 2\\r\\n1 5 7\\r\\n2 7 2\\r\\n2 7 3\\r\\n1 3 6\\r\\n2 7 3\\r\\n2 7 0\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 0 8\\r\\n1 3 5\\r\\n1 0 2\\r\\n1 8 0\\r\\n1 5 3\\r\\n1 5 2\\r\\n2 8 2\\r\\n2 7 6\\r\\n1 6 1\\r\\n2 2 7\\r\\n2 6 5\\r\\n1 3 7\\r\\n2 7 8\\r\\n1 2 4\\r\\n1 4 2\\r\\n2 5 7\\r\\n2 0 6\\r\\n1 3 1\\r\\n2 2 3\\r\\n1 5 7\\r\\n2 2 8\\r\\n1 7 1\\r\\n1 3 0\\r\\n2 5 5\\r\\n1 7 4\\r\\n2 5 5\\r\\n1 2 0\\r\\n2 4 3\\r\\n2 8 1\\r\\n2 8 0\\r\\n1 2 6\\r\\n1 7 5\\r\\n2 4 8\\r\\n1 2 3\\r\\n2 6 6\\r\\n1 7 8\\r\\n2 7 5\\r\\n2 7 4\\r\\n1 8 1\\r\\n2 5 6\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 3\\r\\n1 7 2\\r\\n1 6 2\\r\\n2 0 8\\r\\n2 3 8\\r\\n2 0 3\\r\\n1 5 8\\r\\n2 7 1\\r\\n1 8 1\\r\\n2 8 7\\r\\n1 5 5\\r\\n2 2 4\\r\\n2 3 3\\r\\n2 2 4\\r\\n1 0 1\\r\\n1 2 0\\r\\n1 7 4\\r\\n2 7 4\\r\\n2 5 5\\r\\n1 1 1\\r\\n2 6 4\\r\\n2 1 7\\r\\n2 5 0\\r\\n1 8 0\\r\\n2 6 2\\r\\n1 7 1\\r\\n2 8 6\\r\\n1 8 7\\r\\n2 2 5\\r\\n1 7 3\\r\\n1 5 6\\r\\n1 4 0\\r\\n2 3 8\\r\\n2 8 6\\r\\n1 7 0\\r\\n2 3 5\\r\\n2 6 1\\r\\n1 2 6\\r\\n1 1 2\\r\\n2 7 1\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 4 4\\r\\n1 2 6\\r\\n1 7 2\\r\\n2 1 4\\r\\n2 0 2\\r\\n1 5 4\\r\\n2 5 1\\r\\n1 0 8\\r\\n1 1 7\\r\\n2 2 0\\r\\n1 8 4\\r\\n2 6 5\\r\\n2 8 0\\r\\n1 6 5\\r\\n2 8 7\\r\\n2 0 0\\r\\n2 4 0\\r\\n2 7 2\\r\\n2 6 8\\r\\n1 7 8\\r\\n2 8 8\\r\\n2 4 7\\r\\n1 7 1\\r\\n2 8 8\\r\\n1 5 8\\r\\n1 3 6\\r\\n1 4 6\\r\\n1 3 5\\r\\n2 6 1\\r\\n2 1 3\\r\\n2 8 4\\r\\n2 8 5\\r\\n2 1 3\\r\\n2 7 1\\r\\n2 5 8\\r\\n1 8 2\\r\\n2 6 1\\r\\n1 7 4\\r\\n1 8 5\\r\\n2 6 4\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 2 1\\r\\n1 4 7\\r\\n1 1 1\\r\\n1 2 4\\r\\n2 4 4\\r\\n1 4 4\\r\\n2 0 6\\r\\n2 7 6\\r\\n1 4 0\\r\\n2 6 5\\r\\n2 5 2\\r\\n1 6 1\\r\\n2 7 0\\r\\n1 6 2\\r\\n2 3 2\\r\\n1 0 6\\r\\n2 7 0\\r\\n1 8 6\\r\\n2 1 3\\r\\n2 0 1\\r\\n1 2 5\\r\\n1 0 2\\r\\n2 4 2\\r\\n2 6 8\\r\\n2 2 0\\r\\n2 5 7\\r\\n2 6 0\\r\\n1 2 2\\r\\n2 0 3\\r\\n1 7 4\\r\\n2 7 3\\r\\n1 4 1\\r\\n2 2 6\\r\\n2 8 2\\r\\n1 8 3\\r\\n1 8 7\\r\\n1 0 3\\r\\n1 7 0\\r\\n2 2 1\\r\\n2 6 4\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 3 7\\r\\n1 5 8\\r\\n1 4 4\\r\\n1 8 1\\r\\n1 4 6\\r\\n1 6 6\\r\\n2 5 0\\r\\n2 3 4\\r\\n1 5 3\\r\\n2 0 7\\r\\n2 3 1\\r\\n1 5 4\\r\\n1 3 4\\r\\n2 3 4\\r\\n2 8 2\\r\\n1 0 1\\r\\n1 0 8\\r\\n2 3 8\\r\\n1 0 4\\r\\n2 4 6\\r\\n1 7 3\\r\\n2 4 0\\r\\n1 2 3\\r\\n2 8 1\\r\\n2 8 4\\r\\n1 7 0\\r\\n2 2 6\\r\\n2 2 2\\r\\n1 2 2\\r\\n1 6 5\\r\\n1 7 1\\r\\n2 5 1\\r\\n1 2 4\\r\\n2 3 2\\r\\n1 8 4\\r\\n1 7 4\\r\\n1 1 2\\r\\n1 3 2\\r\\n2 7 3\\r\\n2 4 4\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 1 0\\r\\n1 0 7\\r\\n1 8 4\\r\\n2 1 6\\r\\n2 1 2\\r\\n1 0 0\\r\\n1 1 1\\r\\n2 5 2\\r\\n1 8 5\\r\\n1 0 6\\r\\n2 6 8\\r\\n1 4 2\\r\\n1 8 3\\r\\n2 2 3\\r\\n1 6 3\\r\\n2 6 0\\r\\n1 5 3\\r\\n2 0 5\\r\\n1 3 4\\r\\n2 4 4\\r\\n1 8 6\\r\\n1 1 2\\r\\n1 5 7\\r\\n1 5 1\\r\\n1 3 8\\r\\n2 7 0\\r\\n1 7 2\\r\\n1 3 3\\r\\n2 6 5\\r\\n2 5 0\\r\\n2 2 4\\r\\n2 5 5\\r\\n2 4 6\\r\\n1 6 1\\r\\n1 5 2\\r\\n2 7 5\\r\\n1 8 7\\r\\n1 1 6\\r\\n1 4 8\\r\\n2 8 5\\r\\n', 'output': ['YES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 8 1\\r\\n1 8 6\\r\\n1 1 1\\r\\n2 5 4\\r\\n2 7 8\\r\\n1 6 2\\r\\n1 7 4\\r\\n1 4 4\\r\\n2 3 7\\r\\n1 6 3\\r\\n2 0 1\\r\\n1 8 0\\r\\n2 0 3\\r\\n1 6 0\\r\\n1 3 4\\r\\n1 1 8\\r\\n1 3 3\\r\\n2 3 1\\r\\n2 4 0\\r\\n1 4 3\\r\\n2 1 3\\r\\n2 5 4\\r\\n1 8 5\\r\\n2 1 0\\r\\n1 4 7\\r\\n2 5 3\\r\\n2 4 1\\r\\n1 4 0\\r\\n1 6 8\\r\\n1 5 1\\r\\n2 8 3\\r\\n2 5 7\\r\\n1 3 2\\r\\n1 7 5\\r\\n1 7 3\\r\\n1 0 8\\r\\n1 7 8\\r\\n2 7 3\\r\\n2 6 7\\r\\n2 4 2\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '50\\r\\n1 58 -49\\r\\n1 -77 -90\\r\\n1 32 -52\\r\\n1 -89 -31\\r\\n1 99 -34\\r\\n1 -3 -59\\r\\n2 65 93\\r\\n2 67 -51\\r\\n2 25 -47\\r\\n1 -72 86\\r\\n2 48 -45\\r\\n2 64 -70\\r\\n2 -96 -43\\r\\n2 87 -58\\r\\n2 3 21\\r\\n2 39 -57\\r\\n1 -58 49\\r\\n2 -1 87\\r\\n2 -63 19\\r\\n2 -27 90\\r\\n2 31 3\\r\\n1 55 41\\r\\n1 90 39\\r\\n1 -53 28\\r\\n2 49 -51\\r\\n2 6 42\\r\\n1 50 15\\r\\n2 21 -2\\r\\n2 -6 70\\r\\n1 -13 -61\\r\\n2 -60 -69\\r\\n1 -22 33\\r\\n1 -22 17\\r\\n2 30 -98\\r\\n2 -56 -48\\r\\n2 -84 -77\\r\\n2 49 56\\r\\n1 81 29\\r\\n1 26 29\\r\\n1 -14 20\\r\\n2 -37 83\\r\\n1 -91 96\\r\\n2 57 19\\r\\n1 94 54\\r\\n2 25 -30\\r\\n1 92 5\\r\\n2 -48 51\\r\\n2 81 23\\r\\n1 39 -47\\r\\n2 34 89\\r\\n', 'output': ['NO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '50\\r\\n1 7 -8\\r\\n1 -30 -28\\r\\n1 -8 2\\r\\n1 -28 -29\\r\\n2 -8 -21\\r\\n2 -23 19\\r\\n2 -23 18\\r\\n1 6 27\\r\\n2 -17 20\\r\\n1 9 -5\\r\\n2 -27 29\\r\\n1 -8 27\\r\\n2 13 12\\r\\n2 -29 13\\r\\n2 -30 8\\r\\n2 -30 -8\\r\\n1 -24 -21\\r\\n1 -14 -15\\r\\n2 -23 14\\r\\n2 -12 -13\\r\\n1 15 -24\\r\\n1 28 6\\r\\n2 -20 -21\\r\\n1 -8 -13\\r\\n1 -15 -15\\r\\n1 11 20\\r\\n2 24 -26\\r\\n1 -30 -11\\r\\n2 -17 18\\r\\n1 -17 6\\r\\n2 5 -9\\r\\n2 -29 8\\r\\n2 -29 1\\r\\n2 10 24\\r\\n2 29 27\\r\\n2 -12 21\\r\\n2 5 -28\\r\\n2 28 27\\r\\n2 -4 -4\\r\\n1 -24 29\\r\\n1 17 -1\\r\\n1 0 17\\r\\n1 -2 -1\\r\\n2 -7 -10\\r\\n1 5 -16\\r\\n2 -3 -26\\r\\n2 -7 17\\r\\n1 -27 -26\\r\\n1 -3 -30\\r\\n2 28 -15\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\n']}, {'input': '10\\r\\n1 0 0\\r\\n1 6 0\\r\\n1 0 6\\r\\n2 0 0\\r\\n2 6 0\\r\\n2 0 6\\r\\n2 3 3\\r\\n2 3 0\\r\\n2 0 3\\r\\n2 2 2\\r\\n', 'output': ['YES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '50\\r\\n1 33 -21\\r\\n1 9 82\\r\\n1 -69 -54\\r\\n2 -3 84\\r\\n1 -9 -28\\r\\n2 -54 87\\r\\n2 26 -64\\r\\n2 8 52\\r\\n2 98 63\\r\\n2 -77 10\\r\\n2 -52 -46\\r\\n1 92 42\\r\\n2 -53 -69\\r\\n2 -48 44\\r\\n1 -52 90\\r\\n2 56 29\\r\\n2 -100 -13\\r\\n2 -23 1\\r\\n2 6 91\\r\\n2 53 -38\\r\\n1 48 -35\\r\\n2 19 -62\\r\\n2 -62 49\\r\\n1 59 78\\r\\n2 85 72\\r\\n2 28 76\\r\\n2 46 -91\\r\\n2 6 32\\r\\n2 -16 -59\\r\\n1 40 -53\\r\\n2 -6 87\\r\\n2 -79 -58\\r\\n2 -12 25\\r\\n2 73 49\\r\\n1 57 -42\\r\\n2 12 19\\r\\n1 -60 -5\\r\\n1 -40 -20\\r\\n1 90 35\\r\\n2 10 3\\r\\n2 63 -49\\r\\n1 50 10\\r\\n1 0 77\\r\\n1 92 24\\r\\n1 71 -7\\r\\n2 46 22\\r\\n1 19 81\\r\\n1 -3 -71\\r\\n2 -44 56\\r\\n2 92 34\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}, {'input': '40\\r\\n1 3 3\\r\\n1 3 1\\r\\n1 0 1\\r\\n2 3 0\\r\\n2 6 5\\r\\n2 1 5\\r\\n2 8 3\\r\\n2 0 5\\r\\n2 3 4\\r\\n1 7 6\\r\\n1 1 0\\r\\n1 0 8\\r\\n1 3 7\\r\\n2 4 5\\r\\n2 2 5\\r\\n2 2 0\\r\\n1 7 4\\r\\n2 7 3\\r\\n1 5 0\\r\\n1 4 6\\r\\n1 1 5\\r\\n1 7 8\\r\\n2 7 5\\r\\n1 0 4\\r\\n2 3 8\\r\\n1 1 8\\r\\n1 0 5\\r\\n1 4 8\\r\\n2 8 5\\r\\n1 8 5\\r\\n2 3 6\\r\\n1 8 7\\r\\n2 4 3\\r\\n1 5 2\\r\\n2 2 8\\r\\n2 5 3\\r\\n2 4 0\\r\\n1 4 4\\r\\n1 6 5\\r\\n2 2 7\\r\\n', 'output': ['NO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nNO\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\nYES\\r\\n']}]","id":119} {"description":"Vasya plays FreeDiv. In this game he manages a huge state, which has n cities and m two-way roads between them. Unfortunately, not from every city you can reach any other one moving along these roads. Therefore Vasya decided to divide the state into provinces so that in every province, one could reach from every city all the cities of the province, but there are no roads between provinces. Unlike other turn-based strategies, in FreeDiv a player has the opportunity to build tunnels between cities. The tunnels are two-way roads along which one can move armies undetected by the enemy. However, no more than one tunnel can be connected to each city. As for Vasya, he wants to build a network of tunnels so that any pair of cities in his state were reachable by some path consisting of roads and a tunnels. But at that no more than k tunnels are connected to each province (otherwise, the province will be difficult to keep in case other provinces are captured by enemy armies).Vasya discovered that maybe he will not be able to build such a network for the current condition of the state. Maybe he'll have first to build several roads between cities in different provinces to merge the provinces. Your task is to determine the minimum number of roads Vasya needs to build so that it was possible to build the required network of tunnels in the resulting state.","input_specification":"The first line contains three integers n, m and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u2009106,\u20090\u2009\u2264\u2009m\u2009\u2264\u2009106). Each of the next m lines contains two integers. They are the numbers of cities connected by a corresponding road. No road connects city to itself and there is at most one road between each pair of cities.","output_specification":"Print a single number, the minimum number of additional roads.","notes":"NoteIn the first example only one province exists, so it is not necessary to build any tunnels or roads.In the second example two provinces exist. It is possible to merge the provinces by building a tunnel between cities 1 and 3.In the third example at least one additional road is necessary. For example it is possible to build additional road between cities 1 and 2 and build two tunnels between cities 1 and 3, 2 and 4 after that.","sample_inputs":["3 3 2\n1 2\n2 3\n3 1","4 2 2\n1 2\n3 4","4 0 2"],"sample_outputs":["0","0","1"],"src_uid":"560d70425c765c325f412152c8124d2d","lang_cluster":"Java","difficulty":2200,"human_solution":"import java.util.List;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.io.BufferedReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.math.BigInteger;\nimport java.util.LinkedList;\nimport java.util.Collections;\nimport java.io.InputStream;\n\n\/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n * @author AlexFetisov\n *\/\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tInputReader in = new InputReader(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tTaskD solver = new TaskD();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}\n\nclass TaskD {\n public void solve(int testNumber, InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int m = in.nextInt();\n int k = in.nextInt();\n DisjointSet dsu = new DisjointSet(n);\n int[] size = new int[n];\n Arrays.fill(size, 1);\n while (m-- > 0) {\n int a = in.nextInt() - 1;\n int b = in.nextInt() - 1;\n int newSize = size[dsu.findSet(a)] + size[dsu.findSet(b)];\n if (dsu.union(a, b)) {\n int newRep = dsu.findSet(a);\n size[newRep] = newSize;\n }\n }\n List componentSizes = new LinkedList();\n boolean[] u = new boolean[n];\n for (int i = 0; i < n; ++i) {\n int rep = dsu.findSet(i);\n if (!u[rep]) {\n u[rep] = true;\n componentSizes.add(Math.min(size[rep], k));\n }\n }\n if (k == 1) {\n out.println(Math.max(0, componentSizes.size() - 2));\n return;\n }\n\n Collections.sort(componentSizes);\n int singleComponent = 0;\n while (!componentSizes.isEmpty() && componentSizes.get(0) == 1) {\n ++singleComponent;\n componentSizes.remove(0);\n }\n int freeLinks = 0;\n int edges = 0;\n for (int sz : componentSizes) {\n if (edges < 2) {\n freeLinks += sz - 1;\n } else {\n freeLinks += sz - 2;\n }\n ++edges;\n }\n if (singleComponent == 0) {\n out.println(0);\n return;\n }\n if (edges == 0) {\n singleComponent = (singleComponent + 1) \/ 2;\n out.println(singleComponent-1);\n return;\n }\n if (edges == 1) {\n ++freeLinks;\n }\n if (singleComponent <= freeLinks) {\n out.println(0);\n } else {\n singleComponent -= freeLinks;\n singleComponent = (singleComponent + 1) \/ 2;\n out.println(singleComponent);\n }\n }\n}\n\nclass InputReader {\n private BufferedReader reader;\n private StringTokenizer stt;\n\n public InputReader(InputStream stream) {\n reader = new BufferedReader(new InputStreamReader(stream));\n }\n\n public String nextLine() {\n try {\n return reader.readLine().trim();\n } catch (IOException e) {\n return null;\n }\n }\n\n public String nextString() {\n while (stt == null || !stt.hasMoreTokens()) {\n stt = new StringTokenizer(nextLine());\n }\n return stt.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(nextString());\n }\n\n}\n\nclass DisjointSet {\n int[] parent;\n int[] rank;\n\n public DisjointSet(int size) {\n parent = new int[size];\n rank = new int[size];\n for (int i = 0; i < size; ++i) {\n parent[i] = i;\n rank[i] = 0;\n }\n }\n\n public int findSet(int x) {\n if (parent[x] != x) {\n parent[x] = findSet(parent[x]);\n }\n return parent[x];\n }\n\n public boolean union(int x, int y) {\n x = findSet(x);\n y = findSet(y);\n if (x != y) {\n if (rank[x] < rank[y]) {\n parent[x] = y;\n } else {\n parent[y] = x;\n if (rank[x] == rank[y]) {\n ++rank[x];\n }\n }\n return true;\n }\n return false;\n }\n}\n\n","testcases":"[{'input': '3 3 2\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['0']}, {'input': '4 2 2\\r\\n1 2\\r\\n3 4\\r\\n', 'output': ['0']}, {'input': '4 0 2\\r\\n', 'output': ['1']}, {'input': '4 0 3\\r\\n', 'output': ['1']}, {'input': '8 3 4\\r\\n1 4\\r\\n4 8\\r\\n8 1\\r\\n', 'output': ['1']}, {'input': '8 3 2\\r\\n1 4\\r\\n4 8\\r\\n8 1\\r\\n', 'output': ['2']}, {'input': '8 3 3\\r\\n1 4\\r\\n4 8\\r\\n8 1\\r\\n', 'output': ['1']}, {'input': '8 0 3\\r\\n', 'output': ['3']}, {'input': '50 0 50\\r\\n', 'output': ['24']}, {'input': '50 0 2\\r\\n', 'output': ['24']}, {'input': '50 0 100\\r\\n', 'output': ['24']}, {'input': '100 0 1\\r\\n', 'output': ['98']}, {'input': '3289 0 2\\r\\n', 'output': ['1644']}, {'input': '1000000 0 1\\r\\n', 'output': ['999998']}, {'input': '1000000 0 2\\r\\n', 'output': ['499999']}, {'input': '1000000 0 1000000\\r\\n', 'output': ['499999']}, {'input': '1000000 0 100\\r\\n', 'output': ['499999']}, {'input': '999999 0 1\\r\\n', 'output': ['999997']}, {'input': '999999 0 2\\r\\n', 'output': ['499999']}, {'input': '999999 0 999999\\r\\n', 'output': ['499999']}, {'input': '102 1 1\\r\\n23 58\\r\\n', 'output': ['99']}, {'input': '102 1 2\\r\\n1 62\\r\\n', 'output': ['49']}, {'input': '102 1 10000\\r\\n66 45\\r\\n', 'output': ['49']}, {'input': '1000000 1 1\\r\\n663349 495214\\r\\n', 'output': ['999997']}, {'input': '1000000 1 2\\r\\n998708 47343\\r\\n', 'output': ['499998']}, {'input': '1000000 1 5\\r\\n789076 458264\\r\\n', 'output': ['499998']}, {'input': '11 5 1\\r\\n8 11\\r\\n11 2\\r\\n2 5\\r\\n5 7\\r\\n8 2\\r\\n', 'output': ['5']}, {'input': '11 5 2\\r\\n1 6\\r\\n6 7\\r\\n7 2\\r\\n2 11\\r\\n2 1\\r\\n', 'output': ['2']}, {'input': '11 5 3\\r\\n2 7\\r\\n7 9\\r\\n9 8\\r\\n8 3\\r\\n8 7\\r\\n', 'output': ['2']}, {'input': '11 5 4\\r\\n9 8\\r\\n8 4\\r\\n4 1\\r\\n1 10\\r\\n8 1\\r\\n', 'output': ['1']}, {'input': '11 5 5\\r\\n10 8\\r\\n8 7\\r\\n7 11\\r\\n11 6\\r\\n10 7\\r\\n', 'output': ['1']}, {'input': '11 5 6\\r\\n10 1\\r\\n1 8\\r\\n8 7\\r\\n7 3\\r\\n10 7\\r\\n', 'output': ['1']}, {'input': '3 2 1\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['0']}, {'input': '2 0 1\\r\\n', 'output': ['0']}, {'input': '1 0 1\\r\\n', 'output': ['0']}, {'input': '3 0 1\\r\\n', 'output': ['1']}, {'input': '4 0 1\\r\\n', 'output': ['2']}, {'input': '4 1 1\\r\\n1 2\\r\\n', 'output': ['1']}, {'input': '4 2 1\\r\\n1 2\\r\\n3 4\\r\\n', 'output': ['0']}, {'input': '4 3 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n', 'output': ['0']}, {'input': '2 1 1\\r\\n1 2\\r\\n', 'output': ['0']}, {'input': '5 0 1\\r\\n', 'output': ['3']}, {'input': '5 1 1\\r\\n1 2\\r\\n', 'output': ['2']}, {'input': '5 2 1\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['1']}, {'input': '5 2 1\\r\\n1 2\\r\\n3 4\\r\\n', 'output': ['1']}, {'input': '5 3 1\\r\\n1 2\\r\\n2 3\\r\\n4 5\\r\\n', 'output': ['0']}, {'input': '10 0 1\\r\\n', 'output': ['8']}]","id":120} {"description":"Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room.Today was the pilot launch of an automated reading room visitors' accounting system! The scanner of the system is installed at the entrance to the reading room. It records the events of the form \"reader entered room\", \"reader left room\". Every reader is assigned a registration number during the registration procedure at the library \u2014 it's a unique integer from 1 to 106. Thus, the system logs events of two forms: \"+ ri\" \u2014 the reader with registration number ri entered the room; \"- ri\" \u2014 the reader with registration number ri left the room. The first launch of the system was a success, it functioned for some period of time, and, at the time of its launch and at the time of its shutdown, the reading room may already have visitors.Significant funds of the budget of Berland have been spent on the design and installation of the system. Therefore, some of the citizens of the capital now demand to explain the need for this system and the benefits that its implementation will bring. Now, the developers of the system need to urgently come up with reasons for its existence.Help the system developers to find the minimum possible capacity of the reading room (in visitors) using the log of the system available to you.","input_specification":"The first line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of records in the system log. Next follow n events from the system journal in the order in which the were made. Each event was written on a single line and looks as \"+ ri\" or \"- ri\", where ri is an integer from 1 to 106, the registration number of the visitor (that is, distinct visitors always have distinct registration numbers). It is guaranteed that the log is not contradictory, that is, for every visitor the types of any of his two consecutive events are distinct. Before starting the system, and after stopping the room may possibly contain visitors.","output_specification":"Print a single integer \u2014 the minimum possible capacity of the reading room.","notes":"NoteIn the first sample test, the system log will ensure that at some point in the reading room were visitors with registration numbers 1, 1200 and 12001. More people were not in the room at the same time based on the log. Therefore, the answer to the test is 3.","sample_inputs":["6\n+ 12001\n- 12001\n- 1\n- 1200\n+ 1\n+ 7","2\n- 1\n- 2","2\n+ 1\n- 1"],"sample_outputs":["3","2","1"],"src_uid":"6cfd3b0a403212ec68bac1667bce9ef1","lang_cluster":"Python","difficulty":1300,"human_solution":"d=set()\nm=0\nfor _ in range(int(input())):\n\tx,i=input().split()\n\tif x==\"-\":\n\t\tif i in d:d.remove(i)\n\t\telse:m+=1\n\telse:\n\t d.add(i)\n\tm=max(m,len(d))\nprint(m)","testcases":"[{'input': '6\\r\\n+ 12001\\r\\n- 12001\\r\\n- 1\\r\\n- 1200\\r\\n+ 1\\r\\n+ 7\\r\\n', 'output': ['3']}, {'input': '2\\r\\n- 1\\r\\n- 2\\r\\n', 'output': ['2']}, {'input': '2\\r\\n+ 1\\r\\n- 1\\r\\n', 'output': ['1']}, {'input': '5\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n+ 3\\r\\n- 4\\r\\n', 'output': ['3']}, {'input': '3\\r\\n- 1\\r\\n- 2\\r\\n- 3\\r\\n', 'output': ['3']}, {'input': '4\\r\\n+ 1\\r\\n+ 2\\r\\n- 1\\r\\n+ 3\\r\\n', 'output': ['2']}, {'input': '6\\r\\n+ 1\\r\\n+ 2\\r\\n- 1\\r\\n+ 3\\r\\n- 2\\r\\n+ 4\\r\\n', 'output': ['2']}, {'input': '3\\r\\n+ 1\\r\\n+ 2\\r\\n- 3\\r\\n', 'output': ['3']}, {'input': '3\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n', 'output': ['1']}, {'input': '4\\r\\n- 1\\r\\n- 2\\r\\n+ 3\\r\\n+ 4\\r\\n', 'output': ['2']}, {'input': '1\\r\\n+ 1\\r\\n', 'output': ['1']}, {'input': '1\\r\\n- 1\\r\\n', 'output': ['1']}, {'input': '3\\r\\n- 1\\r\\n+ 1\\r\\n- 1\\r\\n', 'output': ['1']}, {'input': '10\\r\\n+ 1\\r\\n+ 2\\r\\n+ 3\\r\\n+ 4\\r\\n+ 5\\r\\n+ 6\\r\\n+ 7\\r\\n+ 8\\r\\n+ 9\\r\\n+ 10\\r\\n', 'output': ['10']}, {'input': '5\\r\\n+ 5\\r\\n+ 4\\r\\n- 4\\r\\n- 5\\r\\n+ 5\\r\\n', 'output': ['2']}, {'input': '50\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n+ 100\\r\\n- 100\\r\\n', 'output': ['1']}, {'input': '10\\r\\n- 8\\r\\n- 4\\r\\n+ 8\\r\\n+ 10\\r\\n+ 6\\r\\n- 8\\r\\n+ 9\\r\\n- 2\\r\\n- 7\\r\\n+ 4\\r\\n', 'output': ['5']}, {'input': '20\\r\\n+ 3\\r\\n- 3\\r\\n- 2\\r\\n+ 2\\r\\n+ 3\\r\\n- 5\\r\\n- 1\\r\\n+ 1\\r\\n- 3\\r\\n+ 4\\r\\n- 1\\r\\n+ 1\\r\\n+ 3\\r\\n- 3\\r\\n+ 5\\r\\n- 2\\r\\n- 1\\r\\n+ 2\\r\\n+ 1\\r\\n- 5\\r\\n', 'output': ['4']}, {'input': '50\\r\\n+ 4\\r\\n+ 5\\r\\n+ 3\\r\\n+ 2\\r\\n- 2\\r\\n- 3\\r\\n- 4\\r\\n+ 3\\r\\n+ 2\\r\\n- 3\\r\\n+ 4\\r\\n- 2\\r\\n- 4\\r\\n+ 2\\r\\n+ 3\\r\\n- 3\\r\\n- 5\\r\\n- 1\\r\\n+ 4\\r\\n+ 5\\r\\n- 5\\r\\n+ 3\\r\\n- 4\\r\\n- 3\\r\\n- 2\\r\\n+ 4\\r\\n+ 3\\r\\n+ 2\\r\\n- 2\\r\\n- 4\\r\\n+ 5\\r\\n+ 1\\r\\n+ 4\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n- 3\\r\\n- 5\\r\\n- 4\\r\\n- 1\\r\\n+ 5\\r\\n- 2\\r\\n- 5\\r\\n+ 5\\r\\n+ 3\\r\\n- 3\\r\\n+ 1\\r\\n+ 3\\r\\n+ 2\\r\\n- 1\\r\\n', 'output': ['5']}, {'input': '10\\r\\n- 2\\r\\n+ 1\\r\\n- 1\\r\\n+ 2\\r\\n- 2\\r\\n+ 2\\r\\n+ 1\\r\\n- 1\\r\\n- 2\\r\\n+ 1\\r\\n', 'output': ['2']}, {'input': '50\\r\\n+ 1\\r\\n+ 2\\r\\n+ 3\\r\\n+ 4\\r\\n+ 5\\r\\n+ 6\\r\\n+ 7\\r\\n+ 8\\r\\n+ 9\\r\\n+ 10\\r\\n+ 11\\r\\n+ 12\\r\\n+ 13\\r\\n+ 14\\r\\n+ 15\\r\\n+ 16\\r\\n+ 17\\r\\n+ 18\\r\\n+ 19\\r\\n+ 20\\r\\n+ 21\\r\\n+ 22\\r\\n+ 23\\r\\n+ 24\\r\\n+ 25\\r\\n+ 26\\r\\n+ 27\\r\\n+ 28\\r\\n+ 29\\r\\n+ 30\\r\\n+ 31\\r\\n+ 32\\r\\n+ 33\\r\\n+ 34\\r\\n+ 35\\r\\n+ 36\\r\\n+ 37\\r\\n+ 38\\r\\n+ 39\\r\\n+ 40\\r\\n+ 41\\r\\n+ 42\\r\\n+ 43\\r\\n+ 44\\r\\n+ 45\\r\\n+ 46\\r\\n+ 47\\r\\n+ 48\\r\\n+ 49\\r\\n+ 50\\r\\n', 'output': ['50']}, {'input': '50\\r\\n- 1\\r\\n- 2\\r\\n- 3\\r\\n- 4\\r\\n- 5\\r\\n- 6\\r\\n- 7\\r\\n- 8\\r\\n- 9\\r\\n- 10\\r\\n- 11\\r\\n- 12\\r\\n- 13\\r\\n- 14\\r\\n- 15\\r\\n- 16\\r\\n- 17\\r\\n- 18\\r\\n- 19\\r\\n- 20\\r\\n- 21\\r\\n- 22\\r\\n- 23\\r\\n- 24\\r\\n- 25\\r\\n- 26\\r\\n- 27\\r\\n- 28\\r\\n- 29\\r\\n- 30\\r\\n- 31\\r\\n- 32\\r\\n- 33\\r\\n- 34\\r\\n- 35\\r\\n- 36\\r\\n- 37\\r\\n- 38\\r\\n- 39\\r\\n- 40\\r\\n- 41\\r\\n- 42\\r\\n- 43\\r\\n- 44\\r\\n- 45\\r\\n- 46\\r\\n- 47\\r\\n- 48\\r\\n- 49\\r\\n- 50\\r\\n', 'output': ['50']}]","id":121} {"description":"You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken clock. Your goal is to change minimum number of digits in order to make clocks display the correct time in the given format.For example, if 00:99 is displayed, it is enough to replace the second 9 with 3 in order to get 00:39 that is a correct time in 24-hours format. However, to make 00:99 correct in 12-hours format, one has to change at least two digits. Additionally to the first change one can replace the second 0 with 1 and obtain 01:39.","input_specification":"The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.","output_specification":"The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.","notes":null,"sample_inputs":["24\n17:30","12\n17:30","24\n99:99"],"sample_outputs":["17:30","07:30","09:09"],"src_uid":"88d56c1e3a7ffa94354ce0c70d8e958f","lang_cluster":"Python","difficulty":1300,"human_solution":"#http:\/\/codeforces.com\/problemset\/problem\/722\/A\n\n\ntime_format = int(raw_input())\ntime = raw_input().split(\":\")\n\nhour = time[0]\nminutes = time[1]\n\n\nif (time_format == 12):\n if (int(hour) > 12):\n if (hour[1] == \"0\"):\n hour = \"10\"\n else: \n hour = \"0\" + hour[1]\n if (hour == \"00\"):\n hour = \"01\"\nelse:\n if (int(hour) > 23): \n hour = \"0\" + hour[1]\n\n\nif (int(minutes) > 59):\n minutes = \"0\" + minutes[1]\n\n\nprint hour + \":\" + minutes\n\n \n\t\n\n\n\n\n\n","testcases":"[{'input': '24\\r\\n17:30\\r\\n', 'output': ['17:30\\r\\n']}, {'input': '12\\r\\n17:30\\r\\n', 'output': ['07:30\\r\\n']}, {'input': '24\\r\\n99:99\\r\\n', 'output': ['09:09\\r\\n']}, {'input': '12\\r\\n05:54\\r\\n', 'output': ['05:54\\r\\n']}, {'input': '12\\r\\n00:05\\r\\n', 'output': ['01:05\\r\\n']}, {'input': '24\\r\\n23:80\\r\\n', 'output': ['23:00\\r\\n']}, {'input': '24\\r\\n73:16\\r\\n', 'output': ['03:16\\r\\n']}, {'input': '12\\r\\n03:77\\r\\n', 'output': ['03:07\\r\\n']}, {'input': '12\\r\\n47:83\\r\\n', 'output': ['07:03\\r\\n']}, {'input': '24\\r\\n23:88\\r\\n', 'output': ['23:08\\r\\n']}, {'input': '24\\r\\n51:67\\r\\n', 'output': ['01:07\\r\\n']}, {'input': '12\\r\\n10:33\\r\\n', 'output': ['10:33\\r\\n']}, {'input': '12\\r\\n00:01\\r\\n', 'output': ['01:01\\r\\n']}, {'input': '12\\r\\n07:74\\r\\n', 'output': ['07:04\\r\\n']}, {'input': '12\\r\\n00:60\\r\\n', 'output': ['01:00\\r\\n']}, {'input': '24\\r\\n08:32\\r\\n', 'output': ['08:32\\r\\n']}, {'input': '24\\r\\n42:59\\r\\n', 'output': ['02:59\\r\\n']}, {'input': '24\\r\\n19:87\\r\\n', 'output': ['19:07\\r\\n']}, {'input': '24\\r\\n26:98\\r\\n', 'output': ['06:08\\r\\n']}, {'input': '12\\r\\n12:91\\r\\n', 'output': ['12:01\\r\\n']}, {'input': '12\\r\\n11:30\\r\\n', 'output': ['11:30\\r\\n']}, {'input': '12\\r\\n90:32\\r\\n', 'output': ['10:32\\r\\n']}, {'input': '12\\r\\n03:69\\r\\n', 'output': ['03:09\\r\\n']}, {'input': '12\\r\\n33:83\\r\\n', 'output': ['03:03\\r\\n']}, {'input': '24\\r\\n10:45\\r\\n', 'output': ['10:45\\r\\n']}, {'input': '24\\r\\n65:12\\r\\n', 'output': ['05:12\\r\\n']}, {'input': '24\\r\\n22:64\\r\\n', 'output': ['22:04\\r\\n']}, {'input': '24\\r\\n48:91\\r\\n', 'output': ['08:01\\r\\n']}, {'input': '12\\r\\n02:51\\r\\n', 'output': ['02:51\\r\\n']}, {'input': '12\\r\\n40:11\\r\\n', 'output': ['10:11\\r\\n']}, {'input': '12\\r\\n02:86\\r\\n', 'output': ['02:06\\r\\n']}, {'input': '12\\r\\n99:96\\r\\n', 'output': ['09:06\\r\\n']}, {'input': '24\\r\\n19:24\\r\\n', 'output': ['19:24\\r\\n']}, {'input': '24\\r\\n55:49\\r\\n', 'output': ['05:49\\r\\n']}, {'input': '24\\r\\n01:97\\r\\n', 'output': ['01:07\\r\\n']}, {'input': '24\\r\\n39:68\\r\\n', 'output': ['09:08\\r\\n']}, {'input': '24\\r\\n24:00\\r\\n', 'output': ['04:00\\r\\n']}, {'input': '12\\r\\n91:00\\r\\n', 'output': ['01:00\\r\\n']}, {'input': '24\\r\\n00:30\\r\\n', 'output': ['00:30\\r\\n']}, {'input': '12\\r\\n13:20\\r\\n', 'output': ['03:20\\r\\n']}, {'input': '12\\r\\n13:00\\r\\n', 'output': ['03:00\\r\\n']}, {'input': '12\\r\\n42:35\\r\\n', 'output': ['02:35\\r\\n']}, {'input': '12\\r\\n20:00\\r\\n', 'output': ['10:00\\r\\n']}, {'input': '12\\r\\n21:00\\r\\n', 'output': ['01:00\\r\\n']}, {'input': '24\\r\\n10:10\\r\\n', 'output': ['10:10\\r\\n']}, {'input': '24\\r\\n30:40\\r\\n', 'output': ['00:40\\r\\n']}, {'input': '24\\r\\n12:00\\r\\n', 'output': ['12:00\\r\\n']}, {'input': '12\\r\\n10:60\\r\\n', 'output': ['10:00\\r\\n']}, {'input': '24\\r\\n30:00\\r\\n', 'output': ['00:00\\r\\n']}, {'input': '24\\r\\n34:00\\r\\n', 'output': ['04:00\\r\\n']}, {'input': '12\\r\\n22:00\\r\\n', 'output': ['02:00\\r\\n']}, {'input': '12\\r\\n20:20\\r\\n', 'output': ['10:20\\r\\n']}]","id":122} {"description":"Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a \"domino show\".Chris arranges n dominoes in a line, placing each piece vertically upright. In the beginning, he simultaneously pushes some of the dominoes either to the left or to the right. However, somewhere between every two dominoes pushed in the same direction there is at least one domino pushed in the opposite direction.After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right push their adjacent dominoes standing on the right. When a vertical domino has dominoes falling on it from both sides, it stays still due to the balance of the forces. The figure shows one possible example of the process. Given the initial directions Chris has pushed the dominoes, find the number of the dominoes left standing vertically at the end of the process!","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20093000), the number of the dominoes in the line. The next line contains a character string s of length n. The i-th character of the string si is equal to \"L\", if the i-th domino has been pushed to the left; \"R\", if the i-th domino has been pushed to the right; \".\", if the i-th domino has not been pushed. It is guaranteed that if si\u2009=\u2009sj\u2009=\u2009\"L\" and i\u2009<\u2009j, then there exists such k that i\u2009<\u2009k\u2009<\u2009j and sk\u2009=\u2009\"R\"; if si\u2009=\u2009sj\u2009=\u2009\"R\" and i\u2009<\u2009j, then there exists such k that i\u2009<\u2009k\u2009<\u2009j and sk\u2009=\u2009\"L\".","output_specification":"Output a single integer, the number of the dominoes that remain vertical at the end of the process.","notes":"NoteThe first example case is shown on the figure. The four pieces that remain standing vertically are highlighted with orange.In the second example case, all pieces fall down since the first piece topples all the other pieces.In the last example case, a single piece has not been pushed in either direction.","sample_inputs":["14\n.L.R...LR..L..","5\nR....","1\n."],"sample_outputs":["4","0","1"],"src_uid":"54c748dd983b6a0ea1af1153d08f1c01","lang_cluster":"Python","difficulty":1100,"human_solution":"n = int(input())\ns = input()\ns = list(s)\nv = 0\nwhile(True):\n lExits = False\n rExits = False\n if ('L' in s):\n l = s.index('L')\n lExits = True\n if ('R' in s):\n r = s.index('R')\n rExits = True\n if (lExits == False and rExits == False):\n break\n if (lExits == True and rExits == False):\n for i in range(l+1):\n s[i] = 'F'\n break\n if (lExits == False and rExits == True):\n for i in range(r,n):\n s[i] = 'F'\n break\n if (lExits == True and rExits == True):\n if (l < r):\n for i in range(l+1):\n s[i] = 'F'\n else:\n for i in range(r,l+1):\n s[i] = 'F'\n if ((l - r) % 2 == 0):\n s[r] = '.'\nc = 0\nfor i in s:\n if (i == '.'):\n c += 1\nprint(c)\n \n","testcases":"[{'input': '1\\r\\n.\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\nL\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\nR\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\nL.\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\nRL\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n..\\r\\n', 'output': ['2\\r\\n']}, {'input': '6\\r\\n..L.RL\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\nLR\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n.R\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\nR.\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n.L\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\nRLR\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\nLRL\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n.L.R.\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n.R.L.\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\nRL.RL\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\nL.R\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\nR..\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n..RL.\\r\\n', 'output': ['3\\r\\n']}, {'input': '4\\r\\n.LR.\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\nL..\\r\\n', 'output': ['2\\r\\n']}]","id":123} {"description":"\"Hey, it's homework time\" \u2014 thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him.The sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once.You are given an arbitrary sequence a1,\u2009a2,\u2009...,\u2009an containing n integers. Each integer is not less than 1 and not greater than 5000. Determine what minimum number of elements Polycarpus needs to change to get a permutation (he should not delete or add numbers). In a single change he can modify any single sequence element (i. e. replace it with another integer).","input_specification":"The first line of the input data contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u20095000) which represents how many numbers are in the sequence. The second line contains a sequence of integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u20095000,\u20091\u2009\u2264\u2009i\u2009\u2264\u2009n).","output_specification":"Print the only number \u2014 the minimum number of changes needed to get the permutation.","notes":"NoteThe first sample contains the permutation, which is why no replacements are required.In the second sample it is enough to replace the first element with the number 1 and that will make the sequence the needed permutation.In the third sample we can replace the second element with number 4 and the fourth element with number 2.","sample_inputs":["3\n3 1 2","2\n2 2","5\n5 3 3 3 1"],"sample_outputs":["0","1","2"],"src_uid":"bdd86c8bc54bbac6e2bb5a9d68b6eb1c","lang_cluster":"Python","difficulty":1000,"human_solution":"# prob B\n\nn = input()\nseq = raw_input()\n\nseq = [int(i) for i in seq.split()]\nseq.sort()\n\ntot = 0\nright_seq = range(1, n+1)\nfor num in seq:\n if num in right_seq:\n right_seq.remove(num)\n else:\n tot += 1\n\nprint tot\n","testcases":"[{'input': '3\\r\\n3 1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n5 3 3 3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n6 6 6 6 6\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n1 1 2 2 8 8 7 7 9 9\\r\\n', 'output': ['5\\r\\n']}, {'input': '8\\r\\n9 8 7 6 5 4 3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '15\\r\\n1 2 3 4 5 5 4 3 2 1 1 2 3 4 5\\r\\n', 'output': ['10\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n5000\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n5000 5000 5000 5000\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n3366 3461 4 5 4370\\r\\n', 'output': ['3\\r\\n']}, {'input': '10\\r\\n8 2 10 3 4 6 1 7 9 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n551 3192 3213 2846 3068 1224 3447 1 10 9\\r\\n', 'output': ['7\\r\\n']}, {'input': '15\\r\\n4 1459 12 4281 3241 2748 10 3590 14 845 3518 1721 2 2880 1974\\r\\n', 'output': ['10\\r\\n']}, {'input': '15\\r\\n15 1 8 2 13 11 12 7 3 14 6 10 9 4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '15\\r\\n2436 2354 4259 1210 2037 2665 700 3578 2880 973 1317 1024 24 3621 4142\\r\\n', 'output': ['15\\r\\n']}, {'input': '30\\r\\n28 1 3449 9 3242 4735 26 3472 15 21 2698 7 4073 3190 10 3 29 1301 4526 22 345 3876 19 12 4562 2535 2 630 18 27\\r\\n', 'output': ['14\\r\\n']}, {'input': '100\\r\\n50 39 95 30 66 78 2169 4326 81 31 74 34 80 40 19 48 97 63 82 6 88 16 21 57 92 77 10 1213 17 93 32 91 38 4375 29 75 44 22 4 45 14 2395 3254 59 3379 2 85 96 8 83 27 94 1512 2960 100 9 73 79 7 25 55 69 90 99 51 87 98 62 18 35 43 4376 4668 28 72 56 4070 61 65 36 54 4106 11 24 15 86 70 71 4087 23 13 76 20 4694 26 4962 4726 37 14 64\\r\\n', 'output': ['18\\r\\n']}, {'input': '100\\r\\n340 14 3275 2283 2673 1107 817 2243 1226 32 2382 3638 4652 418 68 4962 387 764 4647 159 1846 225 2760 4904 3150 403 3 2439 91 4428 92 4705 75 348 1566 1465 69 6 49 4 62 4643 564 1090 3447 1871 2255 139 24 99 2669 969 86 61 4550 158 4537 3993 1589 872 2907 1888 401 80 1825 1483 63 1 2264 4068 4113 2548 41 885 4806 36 67 167 4447 34 1248 2593 82 202 81 1783 1284 4973 16 43 95 7 865 2091 3008 1793 20 947 4912 3604\\r\\n', 'output': ['70\\r\\n']}, {'input': '1\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n5000 5000\\r\\n', 'output': ['2\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n1 2 3 4 5 6 7 1000 10 10\\r\\n', 'output': ['2\\r\\n']}]","id":124} {"description":"Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the game begins. There are n boys playing football in the yard (including Petya), each boy's football playing skill is expressed with a non-negative characteristic ai (the larger it is, the better the boy plays). Let's denote the number of players in the first team as x, the number of players in the second team as y, the individual numbers of boys who play for the first team as pi and the individual numbers of boys who play for the second team as qi. Division n boys into two teams is considered fair if three conditions are fulfilled: Each boy plays for exactly one team (x\u2009+\u2009y\u2009=\u2009n). The sizes of teams differ in no more than one (|x\u2009-\u2009y|\u2009\u2264\u20091). The total football playing skills for two teams differ in no more than by the value of skill the best player in the yard has. More formally: Your task is to help guys divide into two teams fairly. It is guaranteed that a fair division into two teams always exists.","input_specification":"The first line contains the only integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009104), the i-th number represents the i-th boy's playing skills. ","output_specification":"On the first line print an integer x \u2014 the number of boys playing for the first team. On the second line print x integers \u2014 the individual numbers of boys playing for the first team. On the third line print an integer y \u2014 the number of boys playing for the second team, on the fourth line print y integers \u2014 the individual numbers of boys playing for the second team. Don't forget that you should fulfil all three conditions: x\u2009+\u2009y\u2009=\u2009n, |x\u2009-\u2009y|\u2009\u2264\u20091, and the condition that limits the total skills. If there are multiple ways to solve the problem, print any of them. The boys are numbered starting from one in the order in which their skills are given in the input data. You are allowed to print individual numbers of boys who belong to the same team in any order.","notes":"NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2\u2009-\u20091|\u2009=\u20091\u2009\u2264\u20091) is fulfilled, the third limitation on the difference in skills ((2\u2009+\u20091)\u2009-\u2009(1)\u2009=\u20092\u2009\u2264\u20092) is fulfilled.","sample_inputs":["3\n1 2 1","5\n2 3 3 1 1"],"sample_outputs":["2\n1 2 \n1\n3","3\n4 1 3 \n2\n5 2"],"src_uid":"0937a7e2f912fc094cc4275fd47cd457","lang_cluster":"Python","difficulty":1500,"human_solution":"n = int(input())\na = list(map(int, input().split()))\nall = []\nfor i in range(n):\n all.append([a[i], i + 1])\n\nall.sort(key = lambda x: x[0])\n\nteam_1 = []\nteam_2 = []\nfor i in range(n):\n if i % 2 == 0:\n team_1.append(all[i][1])\n else:\n team_2.append(all[i][1])\n\nprint(len(team_1))\nprint(*team_1)\nprint(len(team_2))\nprint(*team_2)","testcases":"[{'input': '3\\r\\n1 2 1\\r\\n', 'output': ['2\\r\\n1 2 \\r\\n1\\r\\n3 \\r\\n']}, {'input': '5\\r\\n2 3 3 1 1\\r\\n', 'output': ['3\\r\\n4 1 3 \\r\\n2\\r\\n5 2 \\r\\n']}, {'input': '10\\r\\n2 2 2 2 2 2 2 1 2 2\\r\\n', 'output': ['5\\r\\n8 2 4 6 9 \\r\\n5\\r\\n1 3 5 7 10 \\r\\n']}, {'input': '10\\r\\n2 3 3 1 3 1 1 1 2 2\\r\\n', 'output': ['5\\r\\n4 7 1 10 3 \\r\\n5\\r\\n6 8 9 2 5 \\r\\n']}, {'input': '10\\r\\n2 3 2 3 3 1 1 3 1 1\\r\\n', 'output': ['5\\r\\n6 9 1 2 5 \\r\\n5\\r\\n7 10 3 4 8 \\r\\n']}, {'input': '11\\r\\n1 3 1 2 1 2 2 2 1 1 1\\r\\n', 'output': ['6\\r\\n1 5 10 4 7 2 \\r\\n5\\r\\n3 9 11 6 8 \\r\\n']}, {'input': '11\\r\\n54 83 96 75 33 27 36 35 26 22 77\\r\\n', 'output': ['6\\r\\n10 6 8 1 11 3 \\r\\n5\\r\\n9 5 7 4 2 \\r\\n']}, {'input': '11\\r\\n1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['6\\r\\n1 3 5 7 9 11 \\r\\n5\\r\\n2 4 6 8 10 \\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1\\r\\n1 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '2\\r\\n35 36\\r\\n', 'output': ['1\\r\\n1 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '25\\r\\n1 2 2 1 2 2 2 2 2 1 1 2 2 2 2 2 1 2 2 2 1 1 2 2 1\\r\\n', 'output': ['13\\r\\n1 10 17 22 2 5 7 9 13 15 18 20 24 \\r\\n12\\r\\n4 11 21 25 3 6 8 12 14 16 19 23 \\r\\n']}, {'input': '27\\r\\n2 1 1 3 1 2 1 1 3 2 3 1 3 2 1 3 2 3 2 1 2 3 2 2 1 2 1\\r\\n', 'output': ['14\\r\\n2 5 8 15 25 1 10 17 21 24 4 11 16 22 \\r\\n13\\r\\n3 7 12 20 27 6 14 19 23 26 9 13 18 \\r\\n']}, {'input': '30\\r\\n2 2 2 3 4 3 4 4 3 2 3 2 2 4 1 4 2 4 2 2 1 4 3 2 1 3 1 1 4 3\\r\\n', 'output': ['15\\r\\n15 25 28 2 10 13 19 24 6 11 26 5 8 16 22 \\r\\n15\\r\\n21 27 1 3 12 17 20 4 9 23 30 7 14 18 29 \\r\\n']}, {'input': '100\\r\\n3 4 8 10 8 6 4 3 7 7 6 2 3 1 3 10 1 7 9 3 5 5 2 6 2 9 1 7 4 2 4 1 6 1 7 10 2 5 3 7 6 4 6 2 8 8 8 6 6 10 3 7 4 3 4 1 7 9 3 6 3 6 1 4 9 3 8 1 10 1 4 10 7 7 9 5 3 8 10 2 1 10 8 7 10 8 5 3 1 2 1 10 6 1 5 3 3 5 7 2\\r\\n', 'output': ['50\\r\\n14 27 34 63 70 89 94 23 30 44 90 1 13 20 51 59 66 88 97 7 31 53 64 21 38 87 98 11 33 43 49 62 9 18 35 52 73 84 3 45 47 78 86 26 65 4 36 69 79 85 \\r\\n50\\r\\n17 32 56 68 81 91 12 25 37 80 100 8 15 39 54 61 77 96 2 29 42 55 71 22 76 95 6 24 41 48 60 93 10 28 40 57 74 99 5 46 67 83 19 58 75 16 50 72 82 92 \\r\\n']}, {'input': '100\\r\\n85 50 17 89 65 89 5 20 86 26 16 21 85 14 44 31 87 31 6 2 48 67 8 80 79 1 48 36 97 1 5 30 79 50 78 12 2 55 76 100 54 40 26 81 97 96 68 56 87 14 51 17 54 37 52 33 69 62 38 63 74 15 62 78 9 19 67 2 60 58 93 60 18 96 55 48 34 7 79 82 32 58 90 67 20 50 27 15 7 89 98 10 11 15 99 49 4 51 77 52\\r\\n', 'output': ['50\\r\\n26 20 68 7 19 89 65 93 14 62 94 3 73 8 12 43 32 18 56 28 59 15 27 96 34 51 55 41 38 48 82 72 63 5 67 47 61 99 64 33 24 80 13 17 4 90 71 74 45 95 \\r\\n50\\r\\n30 37 97 31 78 23 92 36 50 88 11 52 66 85 10 87 16 81 77 54 42 21 76 2 86 98 100 53 75 70 69 58 60 22 84 57 39 35 25 79 44 1 9 49 6 83 46 29 91 40 \\r\\n']}, {'input': '100\\r\\n2382 7572 9578 1364 2325 2929 7670 5574 2836 2440 6553 1751 929 8785 6894 9373 9308 7338 6380 9541 9951 6785 8993 9942 5087 7544 6582 7139 8458 7424 9759 8199 9464 8817 7625 6200 4955 9373 9500 3062 849 4210 9337 5466 2190 8150 4971 3145 869 5675 1975 161 1998 378 5229 9000 8958 761 358 434 7636 8295 4406 73 375 812 2473 3652 9067 3052 5287 2850 6987 5442 2625 8894 8733 791 9763 5258 8259 9530 2050 7334 2118 2726 8221 5527 8827 1585 8334 8898 6399 6217 7400 2576 5164 9063 6247 9433\\r\\n', 'output': ['50\\r\\n64 59 54 58 66 49 4 12 53 85 5 10 96 86 72 70 48 42 37 25 55 71 44 8 36 99 93 27 15 28 18 30 2 61 46 87 62 29 14 89 92 23 98 17 16 100 39 20 31 24 \\r\\n50\\r\\n52 65 60 78 41 13 90 51 83 45 1 67 75 9 6 40 68 63 47 97 80 74 88 50 94 19 11 22 73 84 95 26 35 7 32 81 91 77 34 76 57 56 69 43 38 33 82 3 79 21 \\r\\n']}, {'input': '3\\r\\n1 2 3\\r\\n', 'output': ['2\\r\\n1 3 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '3\\r\\n10 10 10\\r\\n', 'output': ['2\\r\\n1 3 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '3\\r\\n5 10 10\\r\\n', 'output': ['2\\r\\n1 3 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '5\\r\\n6 1 1 1 1\\r\\n', 'output': ['3\\r\\n2 4 1 \\r\\n2\\r\\n3 5 \\r\\n']}, {'input': '5\\r\\n1 100 2 200 3\\r\\n', 'output': ['3\\r\\n1 5 4 \\r\\n2\\r\\n3 2 \\r\\n']}]","id":125} {"description":"One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1\u2009\u2264\u2009i\u2009<\u2009j\u2009\u2264\u2009n, 1\u2009\u2264\u2009k\u2009\u2264\u2009m), then he took names number i and j and swapped their prefixes of length k. For example, if we take names \"CBDAD\" and \"AABRD\" and swap their prefixes with the length of 3, the result will be names \"AABAD\" and \"CBDRD\".You wonder how many different names Vasya can write instead of name number 1, if Vasya is allowed to perform any number of the described actions. As Vasya performs each action, he chooses numbers i, j, k independently from the previous moves and his choice is based entirely on his will. The sought number can be very large, so you should only find it modulo 1000000007 (109\u2009+\u20097).","input_specification":"The first input line contains two integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100) \u2014 the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.","output_specification":"Print the single number \u2014 the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109\u2009+\u20097).","notes":"NoteIn the first sample Vasya can get the following names in the position number 1: \"AAB\", \"AAA\", \"BAA\" and \"BAB\".","sample_inputs":["2 3\nAAB\nBAA","4 5\nABABA\nBCGDG\nAAAAA\nYABSA"],"sample_outputs":["4","216"],"src_uid":"a37df9b239a40473516d1525d56a0da7","lang_cluster":"Python","difficulty":1400,"human_solution":"n, m = map(int, raw_input().split())\n\nnomes = []\n\nfor i in xrange(n):\n\tentrada = raw_input()\n\tnomes.append(entrada)\n\ntotal = 1\n\nfor k in xrange(m):\n\t\n\tparcial = [nomes[0][k]]\n\tfor l in xrange(1, n):\n\t\t\n\t\tif(nomes[l][k] not in parcial):\n\t\t\tparcial.append(nomes[l][k])\n\t\t\t\n\ttotal *= len(parcial)\n\t\nprint total % 1000000007","testcases":"[{'input': '2 3\\r\\nAAB\\r\\nBAA\\r\\n', 'output': ['4\\r\\n']}, {'input': '4 5\\r\\nABABA\\r\\nBCGDG\\r\\nAAAAA\\r\\nYABSA\\r\\n', 'output': ['216\\r\\n']}, {'input': '1 1\\r\\nE\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 2\\r\\nNS\\r\\nPD\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 4\\r\\nPJKD\\r\\nNFJX\\r\\nFGFK\\r\\n', 'output': ['81\\r\\n']}, {'input': '4 5\\r\\nSXFMY\\r\\nATHLM\\r\\nKDDQW\\r\\nZWGDS\\r\\n', 'output': ['1024\\r\\n']}, {'input': '20 14\\r\\nJNFKBBBJYZHWQE\\r\\nLBOKZCPFNKDBJY\\r\\nXKNWGHQHIOXUPF\\r\\nDDNRUKVUGHWMXW\\r\\nMTIZFNAAFEAPHX\\r\\nIXBQOOHEULZYHU\\r\\nMRCSREUEOOMUUN\\r\\nHJTSQWKUFYZDQU\\r\\nGMCMUZCOPRVEIQ\\r\\nXBKKGGJECOBLTH\\r\\nXXHTLXCNJZJUAF\\r\\nVLJRKXXXWMTPKZ\\r\\nPTYMNPTBBCWKAD\\r\\nQYJGOBUBHMEDYE\\r\\nGTKUUVVNKAHTUI\\r\\nZNKXYZPCYLBZFP\\r\\nQCBLJTRMBDWNNE\\r\\nTDOKJOBKEOVNLZ\\r\\nFKZUITYAFJOQIM\\r\\nUWQNSGLXEEIRWF\\r\\n', 'output': ['515139391\\r\\n']}, {'input': '5 14\\r\\nAQRXUQQNSKZPGC\\r\\nDTTKSPFGGVCLPT\\r\\nVLZQWWESCHDTAZ\\r\\nCOKOWDWDRUOMHP\\r\\nXDTRBIZTTCIDGS\\r\\n', 'output': ['124999979\\r\\n']}, {'input': '9 23\\r\\nOILBYKHRGMPENVFNHLSIUOW\\r\\nLPJFHTUQUINAALRDGLSQUXR\\r\\nLYYJJEBNZATAFQWTDZSPUNZ\\r\\nHSJPIQKKWWERJZIEMLCZUKI\\r\\nOJYIEYDGPFWRHCMISJCCUEM\\r\\nLMGKZVFYIVDRTIHBWPCNUTG\\r\\nUBGGNCITVHAIPKXCLTSAULQ\\r\\nOWSAWUOXQDBSXXBHTLSXUVD\\r\\nUGQTIZQPBGMASRQPVPSFUWK\\r\\n', 'output': ['454717784\\r\\n']}, {'input': '25 4\\r\\nLVKG\\r\\nMICU\\r\\nZHKW\\r\\nLFGG\\r\\nOWQO\\r\\nLCQG\\r\\nLVXU\\r\\nOUKB\\r\\nLNQX\\r\\nZJTO\\r\\nOOQX\\r\\nLVQP\\r\\nMFQB\\r\\nMRQV\\r\\nOIQH\\r\\nOPXX\\r\\nXFKU\\r\\nFCQB\\r\\nZPKH\\r\\nLVCH\\r\\nNFCU\\r\\nOVQW\\r\\nOZKU\\r\\nLFHX\\r\\nLPXO\\r\\n', 'output': ['5733\\r\\n']}, {'input': '30 10\\r\\nUTNTGOKZYJ\\r\\nQHOUHNYZVW\\r\\nLTVGHJRZVW\\r\\nMZHYHOLZYJ\\r\\nERYEUEPZYE\\r\\nUZDBFTURYJ\\r\\nRVSMQTIZGW\\r\\nWDJQHMIRYY\\r\\nKCORHQPZYE\\r\\nRRPLFOZZVY\\r\\nJTXMFNNNYJ\\r\\nMVTGGOZZVV\\r\\nEHAFFNUZVF\\r\\nLBRNWJZNYE\\r\\nJVMOHTPZYJ\\r\\nWTARFJLZVV\\r\\nLVJCWOURVW\\r\\nLCLQFJYRVV\\r\\nQVBVGNJRYF\\r\\nNTZGHOLRYE\\r\\nMGQKHOUPYJ\\r\\nRRSSBXPZYJ\\r\\nRYCRGTLZYJ\\r\\nJRDEGNKRVW\\r\\nRZKFGHYRVG\\r\\nMDJBFNIZYG\\r\\nMPLWHXIZYE\\r\\nSRZMHMURVE\\r\\nMTEBBMRZYJ\\r\\nJPJIFOLZYM\\r\\n', 'output': ['919913906\\r\\n']}, {'input': '40 7\\r\\nPNTVVER\\r\\nPAHTQDR\\r\\nRXMJVAS\\r\\nVIQNLYC\\r\\nILPUSVX\\r\\nYJOXQDJ\\r\\nSEFODTO\\r\\nOTJMREL\\r\\nLIQRZGD\\r\\nLBJJPOR\\r\\nRUTYHQO\\r\\nRIWEPBD\\r\\nKQUMFIB\\r\\nISTRRYH\\r\\nXBTOTGK\\r\\nRFQODEY\\r\\nHDSTZTP\\r\\nYCXFAGL\\r\\nAREGRFU\\r\\nLELZUYU\\r\\nGVABDKH\\r\\nFJAMMME\\r\\nACVULXE\\r\\nJHVPJAS\\r\\nAAQNMBX\\r\\nJJGUCXG\\r\\nOQATILQ\\r\\nNEOSHJM\\r\\nHFLWOFM\\r\\nICYEQHY\\r\\nFACGLYP\\r\\nPLLXJEQ\\r\\nDCHXYPB\\r\\nAGDDZJJ\\r\\nLSQRXTN\\r\\nHDQZXIY\\r\\nNAHDDWW\\r\\nQCMXRQN\\r\\nFDUDSZO\\r\\nHKBEVTW\\r\\n', 'output': ['206575993\\r\\n']}, {'input': '2 2\\r\\nAA\\r\\nBB\\r\\n', 'output': ['4\\r\\n']}, {'input': '1 10\\r\\nAAAAAAAAAA\\r\\n', 'output': ['1\\r\\n']}, {'input': '2 8\\r\\nAAAAAAAA\\r\\nBBBBBBBB\\r\\n', 'output': ['256\\r\\n']}, {'input': '10 10\\r\\nAAAAAAAAAA\\r\\nBBBBBBBBBB\\r\\nCCCCCCCCCC\\r\\nDDDDDDDDDD\\r\\nAAAAAAAAAA\\r\\nBBBBBBBBBB\\r\\nCCCCCCCCCC\\r\\nDDDDDDDDDD\\r\\nAAAAAAAAAA\\r\\nBBBBBBBBBB\\r\\n', 'output': ['1048576\\r\\n']}, {'input': '1 20\\r\\nAAAAAAAAAAAAAAAAAAAA\\r\\n', 'output': ['1\\r\\n']}, {'input': '20 1\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\n', 'output': ['7\\r\\n']}, {'input': '5 60\\r\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\\r\\nCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\\r\\nDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\\r\\nEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\\r\\n', 'output': ['449874206\\r\\n']}, {'input': '50 4\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\nAAAA\\r\\nBBBB\\r\\nCCCC\\r\\nDDDD\\r\\nEEEE\\r\\nFFFF\\r\\nGGGG\\r\\nHHHH\\r\\nIIII\\r\\nJJJJ\\r\\n', 'output': ['10000\\r\\n']}, {'input': '1 100\\r\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\nA\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\nA\\r\\nB\\r\\n', 'output': ['2\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nA\\r\\nB\\r\\n', 'output': ['14\\r\\n']}, {'input': '100 1\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\nW\\r\\nX\\r\\nY\\r\\nZ\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\nW\\r\\nX\\r\\nY\\r\\nZ\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\nW\\r\\nX\\r\\nY\\r\\nZ\\r\\nA\\r\\nB\\r\\nC\\r\\nD\\r\\nE\\r\\nF\\r\\nG\\r\\nH\\r\\nI\\r\\nJ\\r\\nK\\r\\nL\\r\\nM\\r\\nN\\r\\nO\\r\\nP\\r\\nQ\\r\\nR\\r\\nS\\r\\nT\\r\\nU\\r\\nV\\r\\n', 'output': ['26\\r\\n']}]","id":126} {"description":"An African crossword is a rectangular table n\u2009\u00d7\u2009m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a letter should only be crossed out if and only if the corresponding column or row contains at least one more letter that is exactly the same. Besides, all such letters are crossed out simultaneously.When all repeated letters have been crossed out, we should write the remaining letters in a string. The letters that occupy a higher position follow before the letters that occupy a lower position. If the letters are located in one row, then the letter to the left goes first. The resulting word is the answer to the problem.You are suggested to solve an African crossword and print the word encrypted there.","input_specification":"The first line contains two integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100). Next n lines contain m lowercase Latin letters each. That is the crossword grid.","output_specification":"Print the encrypted word on a single line. It is guaranteed that the answer consists of at least one letter.","notes":null,"sample_inputs":["3 3\ncba\nbcd\ncbc","5 5\nfcofd\nooedo\nafaoa\nrdcdf\neofsf"],"sample_outputs":["abcd","codeforces"],"src_uid":"9c90974a0bb860a5e180760042fd5045","lang_cluster":"Python","difficulty":1100,"human_solution":"n, m = list(map(int, input().strip().split()))\nA = [[0] * m] * n\n\n\nfor r in range(n):\n A[r] = list(input().strip())\n\n\ndef in_row(A, r, c):\n x = A[r][c]\n left, right = A[r][:c], A[r][c + 1:]\n if (x in left) or (x in right):\n return True\n\n\ndef in_col(A, r, c):\n x = A[r][c]\n for row in range(n):\n if row == r:\n continue\n if A[row][c] == x:\n return True\n\nout = ''\nfor r in range(n):\n for c in range(m):\n if not in_row(A, r, c) and not in_col(A, r, c): \n out += A[r][c]\n\nprint(out)","testcases":"[{'input': '3 3\\r\\ncba\\r\\nbcd\\r\\ncbc\\r\\n', 'output': ['abcd']}, {'input': '5 5\\r\\nfcofd\\r\\nooedo\\r\\nafaoa\\r\\nrdcdf\\r\\neofsf\\r\\n', 'output': ['codeforces']}, {'input': '4 4\\r\\nusah\\r\\nusha\\r\\nhasu\\r\\nsuha\\r\\n', 'output': ['ahhasusu']}, {'input': '7 5\\r\\naabcd\\r\\neffgh\\r\\niijkk\\r\\nlmnoo\\r\\npqqrs\\r\\nttuvw\\r\\nxxyyz\\r\\n', 'output': ['bcdeghjlmnprsuvwz']}, {'input': '10 10\\r\\naaaaaaaaaa\\r\\nbccceeeeee\\r\\ncdfffffffe\\r\\ncdfiiiiile\\r\\ncdfjjjjile\\r\\ndddddddile\\r\\nedfkkkkile\\r\\nedddddddde\\r\\ngggggggggg\\r\\nhhhhhhhhhe\\r\\n', 'output': ['b']}, {'input': '15 3\\r\\njhg\\r\\njkn\\r\\njui\\r\\nfth\\r\\noij\\r\\nyuf\\r\\nyfb\\r\\nugd\\r\\nhgd\\r\\noih\\r\\nhvc\\r\\nugg\\r\\nyvv\\r\\ntdg\\r\\nhgf\\r\\n', 'output': ['hkniftjfbctd']}, {'input': '17 19\\r\\nbmzbmweyydiadtlcoue\\r\\ngmdbyfwurpwbpuvhifn\\r\\nuapwyndmhtqvkgkbhty\\r\\ntszotwflegsjzzszfwt\\r\\nzfpnscguemwrczqxyci\\r\\nvdqnkypnxnnpmuduhzn\\r\\noaquudhavrncwfwujpc\\r\\nmiggjmcmkkbnjfeodxk\\r\\ngjgwxtrxingiqquhuwq\\r\\nhdswxxrxuzzfhkplwun\\r\\nfagppcoildagktgdarv\\r\\neusjuqfistulgbglwmf\\r\\ngzrnyxryetwzhlnfewc\\r\\nzmnoozlqatugmdjwgzc\\r\\nfabbkoxyjxkatjmpprs\\r\\nwkdkobdagwdwxsufees\\r\\nrvncbszcepigpbzuzoo\\r\\n', 'output': ['lcorviunqvgblgjfsgmrqxyivyxodhvrjpicbneodxjtfkpolvejqmllqadjwotmbgxrvs']}, {'input': '1 1\\r\\na\\r\\n', 'output': ['a']}, {'input': '2 2\\r\\nzx\\r\\nxz\\r\\n', 'output': ['zxxz']}, {'input': '1 2\\r\\nfg\\r\\n', 'output': ['fg']}, {'input': '2 1\\r\\nh\\r\\nj\\r\\n', 'output': ['hj']}, {'input': '1 3\\r\\niji\\r\\n', 'output': ['j']}, {'input': '3 1\\r\\nk\\r\\np\\r\\nk\\r\\n', 'output': ['p']}, {'input': '2 3\\r\\nmhw\\r\\nbfq\\r\\n', 'output': ['mhwbfq']}, {'input': '3 2\\r\\nxe\\r\\ner\\r\\nwb\\r\\n', 'output': ['xeerwb']}, {'input': '3 7\\r\\nnutuvjg\\r\\ntgqutfn\\r\\nyfjeiot\\r\\n', 'output': ['ntvjggqfnyfjeiot']}, {'input': '5 4\\r\\nuzvs\\r\\namfz\\r\\nwypl\\r\\nxizp\\r\\nfhmf\\r\\n', 'output': ['uzvsamfzwyplxizphm']}, {'input': '8 9\\r\\ntjqrtgrem\\r\\nrwjcfuoey\\r\\nywrjgpzca\\r\\nwabzggojv\\r\\najqmmcclh\\r\\nozilebskd\\r\\nqmgnbmtcq\\r\\nwakptzkjr\\r\\n', 'output': ['mrjcfuyyrjpzabzvalhozilebskdgnbtpzr']}, {'input': '9 3\\r\\njel\\r\\njws\\r\\ntab\\r\\nvyo\\r\\nkgm\\r\\npls\\r\\nabq\\r\\nbjx\\r\\nljt\\r\\n', 'output': ['elwtabvyokgmplabqbxlt']}, {'input': '7 6\\r\\neklgxi\\r\\nxmpzgf\\r\\nxvwcmr\\r\\nrqssed\\r\\nouiqpt\\r\\ndueiok\\r\\nbbuorv\\r\\n', 'output': ['eklgximpzgfvwcmrrqedoiqptdeiokuorv']}, {'input': '14 27\\r\\npzoshpvvjdpmwfoeojapmkxjrnk\\r\\nitoojpcorxjdxrwyewtmmlhjxhx\\r\\ndoyopbwusgsmephixzcilxpskxh\\r\\nygpvepeuxjbnezdrnjfwdhjwjka\\r\\nrfjlbypoalbtjwrpjxzenmeipfg\\r\\nkhjhrtktcnajrnbefhpavxxfnlx\\r\\nvwlwumqpfegjgvoezevqsolaqhh\\r\\npdrvrtzqsoujqfeitkqgtxwckrl\\r\\nxtepjflcxcrfomhqimhimnzfxzg\\r\\nwhkfkfvvjwkmwhfgeovwowshyhw\\r\\nolchgmhiehumivswgtfyhqfagbp\\r\\ntdudrkttpkryvaiepsijuejqvmq\\r\\nmuratfqqdbfpefmhjzercortroh\\r\\nwxkebkzchupxumfizftgqvuwgau\\r\\n', 'output': ['zshdanicdyldybwgclygzrhkayatwxznmicbpvlupfsoewcleploqngsyolceswtyqbpyasmuadbpcehqva']}, {'input': '1 100\\r\\nysijllpanprcrrtvokqmmupuptvawhvnekeybdkzqaduotmkfwybqvytkbjfzyqztmxckizheorvkhtyoohbswcmhknyzlgxordu\\r\\n', 'output': ['g']}, {'input': '2 100\\r\\ngplwoaggwuxzutpwnmxhotbexntzmitmcvnvmuxknwvcrnsagvdojdgaccfbheqojgcqievijxapvepwqolmnjqsbejtnkaifstp\\r\\noictcmphxbrylaarcwpruiastazvmfhlcgticvwhpxyiiqokxcjgwlnfykkqdsfmrfaedzchrfzlwdclqjxvidhomhxqnlmuoowg\\r\\n', 'output': ['rbe']}, {'input': '3 100\\r\\nonmhsoxoexfwavmamoecptondioxdjsoxfuqxkjviqnjukwqjwfadnohueaxrkreycicgxpmogijgejxsprwiweyvwembluwwqhj\\r\\nuofldyjyuhzgmkeurawgsrburovdppzjiyddpzxslhyesvmuwlgdjvzjqqcpubfgxliulyvxxloqyhxspoxvhllbrajlommpghlv\\r\\nvdohhghjlvihrzmwskxfatoodupmnouwyyfarhihxpdnbwrvrysrpxxptdidpqabwbfnxhiziiiqtozqjtnitgepxjxosspsjldo\\r\\n', 'output': ['blkck']}, {'input': '100 1\\r\\na\\r\\nm\\r\\nn\\r\\nh\\r\\na\\r\\nx\\r\\nt\\r\\na\\r\\no\\r\\np\\r\\nj\\r\\nz\\r\\nr\\r\\nk\\r\\nq\\r\\nl\\r\\nb\\r\\nr\\r\\no\\r\\ni\\r\\ny\\r\\ni\\r\\np\\r\\ni\\r\\nt\\r\\nn\\r\\nd\\r\\nc\\r\\nz\\r\\np\\r\\nu\\r\\nn\\r\\nw\\r\\ny\\r\\ng\\r\\ns\\r\\nt\\r\\nm\\r\\nz\\r\\ne\\r\\nv\\r\\ng\\r\\ny\\r\\nj\\r\\nd\\r\\nz\\r\\ny\\r\\na\\r\\nn\\r\\nx\\r\\nk\\r\\nd\\r\\nq\\r\\nn\\r\\nv\\r\\ng\\r\\nk\\r\\ni\\r\\nk\\r\\nf\\r\\na\\r\\nb\\r\\nw\\r\\no\\r\\nu\\r\\nw\\r\\nk\\r\\nk\\r\\nb\\r\\nz\\r\\nu\\r\\ni\\r\\nu\\r\\nv\\r\\ng\\r\\nv\\r\\nx\\r\\ng\\r\\np\\r\\ni\\r\\nz\\r\\ns\\r\\nv\\r\\nq\\r\\ns\\r\\nb\\r\\nw\\r\\ne\\r\\np\\r\\nk\\r\\nt\\r\\np\\r\\nd\\r\\nr\\r\\ng\\r\\nd\\r\\nk\\r\\nm\\r\\nf\\r\\nd\\r\\n', 'output': ['hlc']}, {'input': '100 2\\r\\nhd\\r\\ngx\\r\\nmz\\r\\nbq\\r\\nof\\r\\nst\\r\\nzc\\r\\ndg\\r\\nth\\r\\nba\\r\\new\\r\\nbw\\r\\noc\\r\\now\\r\\nvh\\r\\nqp\\r\\nin\\r\\neh\\r\\npj\\r\\nat\\r\\nnn\\r\\nbr\\r\\nij\\r\\nco\\r\\nlv\\r\\nsa\\r\\ntb\\r\\nbl\\r\\nsr\\r\\nxa\\r\\nbz\\r\\nrp\\r\\nsz\\r\\noi\\r\\nec\\r\\npw\\r\\nhf\\r\\njm\\r\\nwu\\r\\nhq\\r\\nra\\r\\npv\\r\\ntc\\r\\ngv\\r\\nik\\r\\nux\\r\\ntz\\r\\nbf\\r\\nty\\r\\ndk\\r\\nwo\\r\\nor\\r\\nza\\r\\nkv\\r\\nqt\\r\\nfa\\r\\njy\\r\\nbk\\r\\nuv\\r\\ngk\\r\\ncz\\r\\nds\\r\\nie\\r\\noq\\r\\nmf\\r\\nxn\\r\\nql\\r\\nxs\\r\\nfb\\r\\niv\\r\\ncj\\r\\nkn\\r\\nns\\r\\nlg\\r\\nji\\r\\nha\\r\\naj\\r\\ndg\\r\\nfj\\r\\nut\\r\\nsg\\r\\nju\\r\\noc\\r\\nov\\r\\nhe\\r\\nnw\\r\\nbl\\r\\nlp\\r\\nbx\\r\\nnm\\r\\nyq\\r\\ncw\\r\\nov\\r\\nxk\\r\\npg\\r\\noh\\r\\npl\\r\\nuo\\r\\ngf\\r\\nul\\r\\n', 'output': ['dvy']}, {'input': '100 3\\r\\nruy\\r\\nmye\\r\\njgp\\r\\nscn\\r\\nktq\\r\\nalx\\r\\nmvk\\r\\nlpm\\r\\nkry\\r\\norb\\r\\nmpu\\r\\nzcv\\r\\nlge\\r\\nkft\\r\\ndzp\\r\\ntfb\\r\\nhqz\\r\\nuur\\r\\nhry\\r\\nzjx\\r\\ncuo\\r\\nqqc\\r\\ntih\\r\\nenj\\r\\nvnp\\r\\nbwi\\r\\nzzh\\r\\nhkc\\r\\nwdr\\r\\nldh\\r\\nvel\\r\\nizj\\r\\nfhb\\r\\nqrn\\r\\nqpp\\r\\nvzs\\r\\nlhg\\r\\nkee\\r\\nlbq\\r\\nzhy\\r\\nwcl\\r\\nyaa\\r\\nton\\r\\nfly\\r\\nkyw\\r\\nept\\r\\ngwq\\r\\ncoe\\r\\nopd\\r\\neez\\r\\nnmx\\r\\nnjg\\r\\nwhy\\r\\nvel\\r\\nafq\\r\\nnbq\\r\\nulx\\r\\noxs\\r\\nbbo\\r\\nyhx\\r\\nfmz\\r\\nnrg\\r\\nnfm\\r\\njek\\r\\nbeu\\r\\ntya\\r\\nxgs\\r\\nsgg\\r\\nnkq\\r\\nbbv\\r\\nwkd\\r\\ntns\\r\\nfdt\\r\\neox\\r\\nobc\\r\\neab\\r\\nkkj\\r\\noub\\r\\ngji\\r\\nrht\\r\\nozv\\r\\nysk\\r\\nsbt\\r\\nflf\\r\\npbu\\r\\nlxb\\r\\npzs\\r\\nrzh\\r\\ncea\\r\\nkmi\\r\\nuea\\r\\nncc\\r\\nzng\\r\\nvkn\\r\\njhn\\r\\njqw\\r\\nlqc\\r\\nmbt\\r\\nlov\\r\\ngam\\r\\n', 'output': ['tvdiixs']}]","id":127} {"description":"A little boy Gerald entered a clothes shop and found out something very unpleasant: not all clothes turns out to match. For example, Gerald noticed that he looks rather ridiculous in a smoking suit and a baseball cap.Overall the shop sells n clothing items, and exactly m pairs of clothing items match. Each item has its price, represented by an integer number of rubles. Gerald wants to buy three clothing items so that they matched each other. Besides, he wants to spend as little money as possible. Find the least possible sum he can spend.","input_specification":"The first input file line contains integers n and m \u2014 the total number of clothing items in the shop and the total number of matching pairs of clothing items (). Next line contains n integers ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009106) \u2014 the prices of the clothing items in rubles. Next m lines each contain a pair of space-separated integers ui and vi (1\u2009\u2264\u2009ui,\u2009vi\u2009\u2264\u2009n,\u2009ui\u2009\u2260\u2009vi). Each such pair of numbers means that the ui-th and the vi-th clothing items match each other. It is guaranteed that in each pair ui and vi are distinct and all the unordered pairs (ui,\u2009vi) are different.","output_specification":"Print the only number \u2014 the least possible sum in rubles that Gerald will have to pay in the shop. If the shop has no three clothing items that would match each other, print \"-1\" (without the quotes).","notes":"NoteIn the first test there only are three pieces of clothing and they all match each other. Thus, there is only one way \u2014 to buy the 3 pieces of clothing; in this case he spends 6 roubles.The second test only has three pieces of clothing as well, yet Gerald can't buy them because the first piece of clothing does not match the third one. Thus, there are no three matching pieces of clothing. The answer is -1.In the third example there are 4 pieces of clothing, but Gerald can't buy any 3 of them simultaneously. The answer is -1.","sample_inputs":["3 3\n1 2 3\n1 2\n2 3\n3 1","3 2\n2 3 4\n2 3\n2 1","4 4\n1 1 1 1\n1 2\n2 3\n3 4\n4 1"],"sample_outputs":["6","-1","-1"],"src_uid":"d90da1e932a6aa546bec4e1bd4b1fbec","lang_cluster":"Python","difficulty":1200,"human_solution":"import itertools\nimport math\n\nimport time\ndef timer(f):\n def tmp(*args, **kwargs):\n t = time.time()\n res = f(*args, **kwargs)\n print(\"\u0412\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438: %f\" % (time.time()-t))\n return res\n\n return tmp\n\n#n = int(input())\n\nn, m = map(int, input().split(' '))\narray = list(map(int, input().split(' ')))\nmatrix = [[0 for j in range(n)] for i in range(n)]\nfor i in range(m):\n a, b = map(int, input().split(' '))\n a-=1\n b-=1\n matrix[a][b] = 1\n matrix[b][a] = 1\n\nprice = 100000000000000\nu = 0;\nuu = 0;\nuuu = 0;\nfor i in range(n):\n for j in range(n):\n for k in range(n):\n if i!=j and j!=k and i!=k:\n if matrix[i][j]==1 and matrix[i][k]==1 and matrix[j][k]==1:\n cp = array[i]+array[j]+array[k]\n if cp= x:\n print(q)\n for i in range(n - 1):\n print(1)\n else:\n print(-1)\n \n","testcases":"[{'input': '5 15 15\\r\\n', 'output': ['11\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '2 3 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 99 11\\r\\n', 'output': ['11\\r\\n']}, {'input': '3 254 18\\r\\n', 'output': ['16\\r\\n1\\r\\n1\\r\\n']}, {'input': '4 324 77\\r\\n', 'output': ['74\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '5 315 90\\r\\n', 'output': ['86\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '6 225 59\\r\\n', 'output': ['54\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '7 351 29\\r\\n', 'output': ['23\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '100 913723780421 955988\\r\\n', 'output': ['-1\\r\\n']}, {'input': '200 894176381082 945808\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1000 824905348050 909242\\r\\n', 'output': ['-1\\r\\n']}, {'input': '31000 819461299082 936240\\r\\n', 'output': ['-1\\r\\n']}, {'input': '44000 772772899626 923074\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99999 681508136225 925533\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99976 664640815001 915230\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100000 729199960625 953931\\r\\n', 'output': ['-1\\r\\n']}, {'input': '50 890543266647 943735\\r\\n', 'output': ['-1\\r\\n']}, {'input': '60 817630084499 904288\\r\\n', 'output': ['904229\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '99999 716046078026 946193\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10000 950051796437 984705\\r\\n', 'output': ['-1\\r\\n']}, {'input': '999 992972391401 997478\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 983300308227 991615\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 912219830404 955103\\r\\n', 'output': ['955102\\r\\n1\\r\\n']}, {'input': '3 934371623645 966631\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 857839030421 926199\\r\\n', 'output': ['-1\\r\\n']}, {'input': '7 897398130730 947317\\r\\n', 'output': ['-1\\r\\n']}, {'input': '60 833021290059 912759\\r\\n', 'output': ['912700\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '1 860113420929 927423\\r\\n', 'output': ['927423\\r\\n']}, {'input': '2 933669982757 966267\\r\\n', 'output': ['966266\\r\\n1\\r\\n']}, {'input': '3 933157932003 966003\\r\\n', 'output': ['966001\\r\\n1\\r\\n1\\r\\n']}, {'input': '4 944626542564 971922\\r\\n', 'output': ['971919\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '7 937519681542 968262\\r\\n', 'output': ['968256\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '100000 1000000000000 1000000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99999 999999999999 999999\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11 10 10\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 5 10\\r\\n', 'output': ['10\\r\\n']}, {'input': '10 3 8\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 37 10\\r\\n', 'output': ['6\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '5 1 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1000000000000 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1000000\\r\\n', 'output': ['1000000\\r\\n']}, {'input': '100000 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100000 1000000000000 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1000000000000 1000000\\r\\n', 'output': ['1000000\\r\\n']}]","id":129} {"description":"When little Petya grew up and entered the university, he started to take part in \u0410\u0421\u041c contests. Later he realized that he doesn't like how the \u0410\u0421\u041c contests are organised: the team could only have three members (and he couldn't take all his friends to the competitions and distribute the tasks between the team members efficiently), so he decided to organize his own contests PFAST Inc. \u2014 Petr and Friends Are Solving Tasks Corporation. PFAST Inc. rules allow a team to have unlimited number of members.To make this format of contests popular he organised his own tournament. To create the team he will prepare for the contest organised by the PFAST Inc. rules, he chose several volunteers (up to 16 people) and decided to compile a team from them. Petya understands perfectly that if a team has two people that don't get on well, then the team will perform poorly. Put together a team with as many players as possible given that all players should get on well with each other.","input_specification":"The first line contains two integer numbers n (1\u2009\u2264\u2009n\u2009\u2264\u200916) \u2014 the number of volunteers, and m () \u2014 the number of pairs that do not get on. Next n lines contain the volunteers' names (each name is a non-empty string consisting of no more than 10 uppercase and\/or lowercase Latin letters). Next m lines contain two names \u2014 the names of the volunteers who do not get on. The names in pair are separated with a single space. Each pair of volunteers who do not get on occurs exactly once. The strings are case-sensitive. All n names are distinct.","output_specification":"The first output line should contain the single number k \u2014 the number of people in the sought team. Next k lines should contain the names of the sought team's participants in the lexicographical order. If there are several variants to solve the problem, print any of them. Petya might not be a member of the sought team. ","notes":null,"sample_inputs":["3 1\nPetya\nVasya\nMasha\nPetya Vasya","3 0\nPasha\nLesha\nVanya"],"sample_outputs":["2\nMasha\nPetya","3\nLesha\nPasha\nVanya"],"src_uid":"b0301a2d79a1ec126511ed769ec0b743","lang_cluster":"Python","difficulty":1500,"human_solution":"n, m = map(int, raw_input().split())\nd = [raw_input() for i in xrange(n)]\nd.sort()\na = [[0] * n for i in xrange(n)]\nfor i in xrange(m):\n x, y = raw_input().split()\n a[d.index(x)][d.index(y)] = a[d.index(y)][d.index(x)] = 1\nres, bit = 0, 0\nfor mask in xrange(1 << n):\n num = 0\n for i in xrange(n):\n if mask >> i & 1:\n num += 1\n for j in xrange(i + 1, n):\n if (mask >> j & 1) != 0 and a[i][j]: num = -20\n if res < num: res = num; bit = mask;\nprint res\nfor i in xrange(n):\n if bit >> i & 1 : print d[i]\n\n ","testcases":"[{'input': '3 1\\r\\nPetya\\r\\nVasya\\r\\nMasha\\r\\nPetya Vasya\\r\\n', 'output': ['2\\r\\nMasha\\r\\nPetya\\r\\n']}, {'input': '3 0\\r\\nPasha\\r\\nLesha\\r\\nVanya\\r\\n', 'output': ['3\\r\\nLesha\\r\\nPasha\\r\\nVanya\\r\\n']}, {'input': '7 12\\r\\nPasha\\r\\nLesha\\r\\nVanya\\r\\nTaras\\r\\nNikita\\r\\nSergey\\r\\nAndrey\\r\\nPasha Taras\\r\\nPasha Nikita\\r\\nPasha Andrey\\r\\nPasha Sergey\\r\\nLesha Taras\\r\\nLesha Nikita\\r\\nLesha Andrey\\r\\nLesha Sergey\\r\\nVanya Taras\\r\\nVanya Nikita\\r\\nVanya Andrey\\r\\nVanya Sergey\\r\\n', 'output': ['4\\r\\nAndrey\\r\\nNikita\\r\\nSergey\\r\\nTaras\\r\\n']}, {'input': '2 0\\r\\nAndrey\\r\\nTaras\\r\\n', 'output': ['2\\r\\nAndrey\\r\\nTaras\\r\\n']}, {'input': '16 0\\r\\nTaras\\r\\nNikita\\r\\nSergey\\r\\nAndrey\\r\\nRomka\\r\\nAlexey\\r\\nUra\\r\\nDenis\\r\\nEgor\\r\\nVadim\\r\\nAlena\\r\\nOlya\\r\\nVanya\\r\\nBrus\\r\\nJohn\\r\\nAlice\\r\\n', 'output': ['16\\r\\nAlena\\r\\nAlexey\\r\\nAlice\\r\\nAndrey\\r\\nBrus\\r\\nDenis\\r\\nEgor\\r\\nJohn\\r\\nNikita\\r\\nOlya\\r\\nRomka\\r\\nSergey\\r\\nTaras\\r\\nUra\\r\\nVadim\\r\\nVanya\\r\\n']}, {'input': '6 6\\r\\nAlena\\r\\nOlya\\r\\nVanya\\r\\nBrus\\r\\nJohn\\r\\nAlice\\r\\nAlena John\\r\\nAlena Alice\\r\\nOlya John\\r\\nOlya Alice\\r\\nVanya John\\r\\nVanya Alice\\r\\n', 'output': ['4\\r\\nAlena\\r\\nBrus\\r\\nOlya\\r\\nVanya\\r\\n']}, {'input': '7 6\\r\\nAlena\\r\\nOlya\\r\\nVanya\\r\\nBrus\\r\\nJohn\\r\\nAlice\\r\\nMariana\\r\\nAlena John\\r\\nAlena Alice\\r\\nOlya John\\r\\nOlya Alice\\r\\nVanya John\\r\\nVanya Alice\\r\\n', 'output': ['5\\r\\nAlena\\r\\nBrus\\r\\nMariana\\r\\nOlya\\r\\nVanya\\r\\n']}, {'input': '1 0\\r\\nPetr\\r\\n', 'output': ['1\\r\\nPetr\\r\\n']}, {'input': '2 0\\r\\nNgzlPJgFgz\\r\\nQfpagVpWz\\r\\n', 'output': ['2\\r\\nNgzlPJgFgz\\r\\nQfpagVpWz\\r\\n']}, {'input': '2 1\\r\\ncLWdg\\r\\nGoWegdDRp\\r\\nGoWegdDRp cLWdg\\r\\n', 'output': ['1\\r\\nGoWegdDRp\\r\\n']}, {'input': '3 0\\r\\nr\\r\\nyVwqs\\r\\nsdTDerOyhp\\r\\n', 'output': ['3\\r\\nr\\r\\nsdTDerOyhp\\r\\nyVwqs\\r\\n']}, {'input': '3 3\\r\\nvRVatwL\\r\\nWmkUGiYEn\\r\\nuvvsXKXcJ\\r\\nWmkUGiYEn vRVatwL\\r\\nuvvsXKXcJ vRVatwL\\r\\nuvvsXKXcJ WmkUGiYEn\\r\\n', 'output': ['1\\r\\nWmkUGiYEn\\r\\n']}, {'input': '16 11\\r\\njA\\r\\nkyRNTE\\r\\neY\\r\\nToLcqN\\r\\nbnenhMxiK\\r\\nzlkOe\\r\\nXCKZ\\r\\neaQrds\\r\\nqUdInpi\\r\\nKgPQA\\r\\nmQIl\\r\\ninOCWEZHxy\\r\\nyA\\r\\nPIZRMOu\\r\\nXtueKFM\\r\\nfRNwNn\\r\\ninOCWEZHxy qUdInpi\\r\\nKgPQA zlkOe\\r\\ninOCWEZHxy KgPQA\\r\\nfRNwNn XCKZ\\r\\ninOCWEZHxy eY\\r\\nyA mQIl\\r\\ninOCWEZHxy ToLcqN\\r\\nyA KgPQA\\r\\nqUdInpi ToLcqN\\r\\nqUdInpi eaQrds\\r\\nPIZRMOu eY\\r\\n', 'output': ['10\\r\\nKgPQA\\r\\nPIZRMOu\\r\\nToLcqN\\r\\nXCKZ\\r\\nXtueKFM\\r\\nbnenhMxiK\\r\\neaQrds\\r\\njA\\r\\nkyRNTE\\r\\nmQIl\\r\\n']}, {'input': '12 12\\r\\njWuGgOjV\\r\\nWs\\r\\njTZQMyH\\r\\nULp\\r\\nUfsnPRt\\r\\nk\\r\\nbPKrnP\\r\\nW\\r\\nJOaQdgglDG\\r\\nAodc\\r\\ncpRjAUyYIW\\r\\nMrjB\\r\\nbPKrnP ULp\\r\\nk Ws\\r\\ncpRjAUyYIW k\\r\\nULp jTZQMyH\\r\\nbPKrnP jWuGgOjV\\r\\ncpRjAUyYIW jTZQMyH\\r\\nW ULp\\r\\nk jTZQMyH\\r\\nk ULp\\r\\nMrjB ULp\\r\\ncpRjAUyYIW Aodc\\r\\nW k\\r\\n', 'output': ['8\\r\\nAodc\\r\\nJOaQdgglDG\\r\\nMrjB\\r\\nUfsnPRt\\r\\nW\\r\\nWs\\r\\nbPKrnP\\r\\njTZQMyH\\r\\n']}, {'input': '11 17\\r\\njFTNgFBO\\r\\ntZDgmdF\\r\\nIjeDjoj\\r\\nBEMAaYkNb\\r\\nRZRQl\\r\\ntK\\r\\nlNHWt\\r\\nIdG\\r\\nLAbVLYiY\\r\\notOBsWqJuo\\r\\nUoTy\\r\\ntK BEMAaYkNb\\r\\nBEMAaYkNb jFTNgFBO\\r\\nIjeDjoj tZDgmdF\\r\\nRZRQl jFTNgFBO\\r\\nlNHWt tZDgmdF\\r\\nRZRQl tZDgmdF\\r\\nUoTy LAbVLYiY\\r\\nBEMAaYkNb IjeDjoj\\r\\nIdG BEMAaYkNb\\r\\nLAbVLYiY tK\\r\\nLAbVLYiY jFTNgFBO\\r\\nUoTy IjeDjoj\\r\\nlNHWt jFTNgFBO\\r\\nlNHWt BEMAaYkNb\\r\\ntK IjeDjoj\\r\\nUoTy RZRQl\\r\\nBEMAaYkNb tZDgmdF\\r\\n', 'output': ['6\\r\\nIdG\\r\\nIjeDjoj\\r\\nLAbVLYiY\\r\\nRZRQl\\r\\nlNHWt\\r\\notOBsWqJuo\\r\\n']}, {'input': '11 13\\r\\ncZAMfd\\r\\nSWQnweM\\r\\nKlQW\\r\\nWRsnNZT\\r\\nix\\r\\nUC\\r\\nLWqsVHcWec\\r\\nfeb\\r\\ncBy\\r\\ntvk\\r\\nRXDlX\\r\\nfeb SWQnweM\\r\\ncBy WRsnNZT\\r\\nLWqsVHcWec KlQW\\r\\nRXDlX feb\\r\\nLWqsVHcWec cZAMfd\\r\\ncBy UC\\r\\nWRsnNZT SWQnweM\\r\\nRXDlX cBy\\r\\ntvk UC\\r\\ncBy SWQnweM\\r\\nUC KlQW\\r\\nRXDlX KlQW\\r\\nUC WRsnNZT\\r\\n', 'output': ['6\\r\\nKlQW\\r\\nWRsnNZT\\r\\ncZAMfd\\r\\nfeb\\r\\nix\\r\\ntvk\\r\\n']}, {'input': '4 2\\r\\nadQx\\r\\nrJGeodBycK\\r\\ntgPYZk\\r\\ncz\\r\\ncz tgPYZk\\r\\nrJGeodBycK adQx\\r\\n', 'output': ['2\\r\\nadQx\\r\\ncz\\r\\n']}, {'input': '4 2\\r\\noVemoZhjW\\r\\nHspFEry\\r\\nhFO\\r\\njxt\\r\\nhFO HspFEry\\r\\njxt oVemoZhjW\\r\\n', 'output': ['2\\r\\nHspFEry\\r\\njxt\\r\\n']}, {'input': '5 2\\r\\niBrgNFlNXd\\r\\nlnGPIV\\r\\nnb\\r\\nB\\r\\nVgqRcEOG\\r\\nlnGPIV iBrgNFlNXd\\r\\nB iBrgNFlNXd\\r\\n', 'output': ['4\\r\\nB\\r\\nVgqRcEOG\\r\\nlnGPIV\\r\\nnb\\r\\n']}, {'input': '5 1\\r\\nWEYUdpYmZp\\r\\nfhNmMpjr\\r\\nydARivBg\\r\\ncilTtE\\r\\nyeXxkhPzB\\r\\nyeXxkhPzB cilTtE\\r\\n', 'output': ['4\\r\\nWEYUdpYmZp\\r\\ncilTtE\\r\\nfhNmMpjr\\r\\nydARivBg\\r\\n']}, {'input': '6 9\\r\\noySkmhCD\\r\\nUIKWj\\r\\nmHolKkBx\\r\\nQBikssqz\\r\\nZ\\r\\nzoFUJYa\\r\\nZ UIKWj\\r\\nQBikssqz oySkmhCD\\r\\nQBikssqz UIKWj\\r\\nZ oySkmhCD\\r\\nzoFUJYa UIKWj\\r\\nzoFUJYa Z\\r\\nzoFUJYa mHolKkBx\\r\\nzoFUJYa QBikssqz\\r\\nQBikssqz mHolKkBx\\r\\n', 'output': ['3\\r\\nUIKWj\\r\\nmHolKkBx\\r\\noySkmhCD\\r\\n']}, {'input': '6 1\\r\\nuPVIuLBuYM\\r\\nVejWyKCtbN\\r\\nqqjgF\\r\\nulBD\\r\\nDRNzxJU\\r\\nCOzbXWOt\\r\\nulBD qqjgF\\r\\n', 'output': ['5\\r\\nCOzbXWOt\\r\\nDRNzxJU\\r\\nVejWyKCtbN\\r\\nqqjgF\\r\\nuPVIuLBuYM\\r\\n']}, {'input': '7 14\\r\\nFXCT\\r\\nn\\r\\no\\r\\nS\\r\\nMdFuonu\\r\\nmszv\\r\\nbqScOCw\\r\\nS o\\r\\nbqScOCw FXCT\\r\\nMdFuonu o\\r\\no n\\r\\nbqScOCw n\\r\\nmszv S\\r\\nbqScOCw MdFuonu\\r\\nmszv n\\r\\nS FXCT\\r\\nbqScOCw o\\r\\no FXCT\\r\\nmszv MdFuonu\\r\\nmszv FXCT\\r\\nbqScOCw mszv\\r\\n', 'output': ['3\\r\\nFXCT\\r\\nMdFuonu\\r\\nn\\r\\n']}, {'input': '7 6\\r\\nj\\r\\nZ\\r\\nPZNeTyY\\r\\nm\\r\\na\\r\\nUj\\r\\nsuaaSiKcK\\r\\nUj PZNeTyY\\r\\na j\\r\\nPZNeTyY Z\\r\\nPZNeTyY j\\r\\nm PZNeTyY\\r\\nm j\\r\\n', 'output': ['5\\r\\nUj\\r\\nZ\\r\\na\\r\\nm\\r\\nsuaaSiKcK\\r\\n']}, {'input': '8 6\\r\\nU\\r\\nC\\r\\nPEElYwaxf\\r\\nVubTXNI\\r\\nJ\\r\\nIxZUHV\\r\\nhLNFnzmqFE\\r\\nDPPvwuWvmA\\r\\nhLNFnzmqFE IxZUHV\\r\\nIxZUHV C\\r\\nJ PEElYwaxf\\r\\nIxZUHV PEElYwaxf\\r\\nPEElYwaxf C\\r\\nJ VubTXNI\\r\\n', 'output': ['5\\r\\nC\\r\\nDPPvwuWvmA\\r\\nJ\\r\\nU\\r\\nhLNFnzmqFE\\r\\n']}, {'input': '8 12\\r\\nBkgxqAF\\r\\nKhq\\r\\nNpIfk\\r\\nkheqUyDVG\\r\\niRBkHlRpp\\r\\nZDaQY\\r\\nNG\\r\\nqN\\r\\nqN BkgxqAF\\r\\nNpIfk BkgxqAF\\r\\niRBkHlRpp BkgxqAF\\r\\niRBkHlRpp NpIfk\\r\\nNG Khq\\r\\niRBkHlRpp Khq\\r\\nNG ZDaQY\\r\\nNG iRBkHlRpp\\r\\nNG NpIfk\\r\\nqN Khq\\r\\nZDaQY kheqUyDVG\\r\\nNpIfk Khq\\r\\n', 'output': ['3\\r\\nBkgxqAF\\r\\nKhq\\r\\nZDaQY\\r\\n']}, {'input': '9 5\\r\\nRFiow\\r\\naxgvtiBGbx\\r\\ngGBVZtI\\r\\nVWAxrqx\\r\\nmnASVEQI\\r\\ntZHzWGAvXc\\r\\nBeaCYhIRLy\\r\\nhTdUL\\r\\nFJd\\r\\nhTdUL RFiow\\r\\nhTdUL gGBVZtI\\r\\nFJd axgvtiBGbx\\r\\nFJd BeaCYhIRLy\\r\\nhTdUL axgvtiBGbx\\r\\n', 'output': ['7\\r\\nBeaCYhIRLy\\r\\nRFiow\\r\\nVWAxrqx\\r\\naxgvtiBGbx\\r\\ngGBVZtI\\r\\nmnASVEQI\\r\\ntZHzWGAvXc\\r\\n']}, {'input': '9 13\\r\\nYiUXqlBUx\\r\\nQNgYuX\\r\\ndPtyZ\\r\\nITtwRJCv\\r\\nLJ\\r\\nrAG\\r\\nOgxNq\\r\\nsitechE\\r\\nvVAAz\\r\\nOgxNq QNgYuX\\r\\nOgxNq dPtyZ\\r\\nsitechE rAG\\r\\nLJ QNgYuX\\r\\nQNgYuX YiUXqlBUx\\r\\nOgxNq LJ\\r\\nvVAAz OgxNq\\r\\nrAG dPtyZ\\r\\nvVAAz LJ\\r\\nvVAAz ITtwRJCv\\r\\nsitechE LJ\\r\\nrAG YiUXqlBUx\\r\\nsitechE QNgYuX\\r\\n', 'output': ['4\\r\\nITtwRJCv\\r\\nLJ\\r\\nYiUXqlBUx\\r\\ndPtyZ\\r\\n']}, {'input': '9 6\\r\\nfLfek\\r\\nEQPcotnrp\\r\\nCaAlbwoIL\\r\\nVG\\r\\nNAZKIBiKT\\r\\noFy\\r\\njFluh\\r\\nKqHXRNya\\r\\nQSwgobA\\r\\noFy EQPcotnrp\\r\\nKqHXRNya jFluh\\r\\noFy NAZKIBiKT\\r\\njFluh oFy\\r\\njFluh fLfek\\r\\noFy fLfek\\r\\n', 'output': ['7\\r\\nCaAlbwoIL\\r\\nEQPcotnrp\\r\\nKqHXRNya\\r\\nNAZKIBiKT\\r\\nQSwgobA\\r\\nVG\\r\\nfLfek\\r\\n']}, {'input': '9 14\\r\\nmoRNeufngu\\r\\nBSKI\\r\\nzXl\\r\\ngwmIDluW\\r\\nYFn\\r\\nHvasEgl\\r\\nXcAC\\r\\neVP\\r\\nAiOm\\r\\neVP BSKI\\r\\neVP YFn\\r\\nHvasEgl YFn\\r\\neVP XcAC\\r\\nAiOm HvasEgl\\r\\nXcAC YFn\\r\\nzXl moRNeufngu\\r\\neVP zXl\\r\\nHvasEgl BSKI\\r\\nXcAC gwmIDluW\\r\\nXcAC HvasEgl\\r\\nYFn moRNeufngu\\r\\nzXl BSKI\\r\\nHvasEgl gwmIDluW\\r\\n', 'output': ['4\\r\\nAiOm\\r\\nBSKI\\r\\nYFn\\r\\ngwmIDluW\\r\\n']}, {'input': '15 8\\r\\ncXeOANpvBF\\r\\nbkeDfi\\r\\nnsEUAKNxQI\\r\\noSIb\\r\\naU\\r\\nXYXYVo\\r\\nduZQ\\r\\naPkr\\r\\nPVrHpL\\r\\nmVgmv\\r\\nhHhukllwbf\\r\\nGkNPGYVxjY\\r\\nbgBjA\\r\\nslNKCLIlOv\\r\\nmPILXy\\r\\nbgBjA cXeOANpvBF\\r\\nGkNPGYVxjY cXeOANpvBF\\r\\nslNKCLIlOv GkNPGYVxjY\\r\\nGkNPGYVxjY mVgmv\\r\\nXYXYVo cXeOANpvBF\\r\\nslNKCLIlOv bkeDfi\\r\\nmVgmv aPkr\\r\\nslNKCLIlOv nsEUAKNxQI\\r\\n', 'output': ['12\\r\\nGkNPGYVxjY\\r\\nPVrHpL\\r\\nXYXYVo\\r\\naPkr\\r\\naU\\r\\nbgBjA\\r\\nbkeDfi\\r\\nduZQ\\r\\nhHhukllwbf\\r\\nmPILXy\\r\\nnsEUAKNxQI\\r\\noSIb\\r\\n']}, {'input': '15 3\\r\\na\\r\\nYclKFJoaIA\\r\\nhalYcB\\r\\nbLOlPzAeQ\\r\\ntckjt\\r\\noDFijpx\\r\\nb\\r\\npz\\r\\nVDLb\\r\\nlCEHPibt\\r\\noF\\r\\npzJD\\r\\nMC\\r\\nqklsX\\r\\nTAU\\r\\npzJD tckjt\\r\\nqklsX oF\\r\\nMC pzJD\\r\\n', 'output': ['13\\r\\nMC\\r\\nTAU\\r\\nVDLb\\r\\nYclKFJoaIA\\r\\na\\r\\nb\\r\\nbLOlPzAeQ\\r\\nhalYcB\\r\\nlCEHPibt\\r\\noDFijpx\\r\\noF\\r\\npz\\r\\ntckjt\\r\\n']}, {'input': '16 8\\r\\nJIo\\r\\nINanHVnP\\r\\nKaxyCBWt\\r\\nkVfnsz\\r\\nRAwFYCrSvI\\r\\nF\\r\\nvIEWWIvh\\r\\nTGF\\r\\nFeuhJJwJ\\r\\nTngcmS\\r\\nSqI\\r\\nRmcaVngp\\r\\neGwhme\\r\\nlwaFfXzM\\r\\noabGmpvVH\\r\\nTMT\\r\\nFeuhJJwJ F\\r\\neGwhme FeuhJJwJ\\r\\nRmcaVngp SqI\\r\\nINanHVnP JIo\\r\\nSqI FeuhJJwJ\\r\\nF kVfnsz\\r\\nTGF F\\r\\nTMT TGF\\r\\n', 'output': ['11\\r\\nF\\r\\nINanHVnP\\r\\nKaxyCBWt\\r\\nRAwFYCrSvI\\r\\nRmcaVngp\\r\\nTMT\\r\\nTngcmS\\r\\neGwhme\\r\\nlwaFfXzM\\r\\noabGmpvVH\\r\\nvIEWWIvh\\r\\n']}, {'input': '16 25\\r\\nbBZ\\r\\nEr\\r\\nZ\\r\\nrYJmfZLgmx\\r\\nPaJNrF\\r\\naHtRqSxOO\\r\\nD\\r\\nhsagsG\\r\\nMDuBOXrmWH\\r\\nSgjMQZ\\r\\nYXgWq\\r\\nxDwpppG\\r\\nSDY\\r\\nJwZWx\\r\\ncOzrgrBaE\\r\\nFJYX\\r\\nYXgWq SgjMQZ\\r\\nSDY PaJNrF\\r\\nFJYX rYJmfZLgmx\\r\\nhsagsG Er\\r\\nxDwpppG rYJmfZLgmx\\r\\naHtRqSxOO rYJmfZLgmx\\r\\nhsagsG bBZ\\r\\nJwZWx hsagsG\\r\\nFJYX cOzrgrBaE\\r\\nSDY YXgWq\\r\\nFJYX Z\\r\\nJwZWx rYJmfZLgmx\\r\\nD rYJmfZLgmx\\r\\nYXgWq Z\\r\\nrYJmfZLgmx Z\\r\\naHtRqSxOO bBZ\\r\\nSDY rYJmfZLgmx\\r\\ncOzrgrBaE D\\r\\nYXgWq hsagsG\\r\\nSDY aHtRqSxOO\\r\\ncOzrgrBaE xDwpppG\\r\\nSDY bBZ\\r\\nSDY Er\\r\\nJwZWx xDwpppG\\r\\nFJYX JwZWx\\r\\n', 'output': ['8\\r\\nD\\r\\nEr\\r\\nJwZWx\\r\\nMDuBOXrmWH\\r\\nPaJNrF\\r\\nSgjMQZ\\r\\nZ\\r\\naHtRqSxOO\\r\\n']}, {'input': '16 37\\r\\ntIWi\\r\\nq\\r\\nIEAYCq\\r\\nXozwkum\\r\\nCC\\r\\niPwfd\\r\\nS\\r\\nXEf\\r\\nWqEiwkH\\r\\nWX\\r\\ne\\r\\nltmruh\\r\\nKGx\\r\\nauTUYZRC\\r\\nmeJa\\r\\nM\\r\\nmeJa q\\r\\nKGx e\\r\\nXEf Xozwkum\\r\\ne q\\r\\nauTUYZRC KGx\\r\\ne CC\\r\\nM CC\\r\\nM meJa\\r\\nWX CC\\r\\nWqEiwkH IEAYCq\\r\\nauTUYZRC WqEiwkH\\r\\nKGx WX\\r\\nmeJa KGx\\r\\nXEf q\\r\\nauTUYZRC XEf\\r\\nauTUYZRC IEAYCq\\r\\nWX XEf\\r\\nM XEf\\r\\nWqEiwkH q\\r\\nM KGx\\r\\nKGx CC\\r\\nM e\\r\\nWqEiwkH Xozwkum\\r\\nCC q\\r\\nS Xozwkum\\r\\nKGx tIWi\\r\\nWX q\\r\\nXEf S\\r\\nauTUYZRC S\\r\\nCC IEAYCq\\r\\nKGx IEAYCq\\r\\ne WqEiwkH\\r\\nM S\\r\\nauTUYZRC q\\r\\nS tIWi\\r\\nM ltmruh\\r\\nM iPwfd\\r\\n', 'output': ['8\\r\\nIEAYCq\\r\\nWX\\r\\nXozwkum\\r\\ne\\r\\niPwfd\\r\\nltmruh\\r\\nmeJa\\r\\ntIWi\\r\\n']}, {'input': '16 11\\r\\ntulhZxeKgo\\r\\nbrAXY\\r\\nyQUkaihDAg\\r\\nmwjlDVaktK\\r\\nweVtBIP\\r\\nzRwb\\r\\nds\\r\\nhXPfJrL\\r\\nAdIfP\\r\\nazQeXn\\r\\nB\\r\\nJlmscIUOxO\\r\\nZuxr\\r\\nV\\r\\nOfyLIUO\\r\\nuaMl\\r\\nhXPfJrL yQUkaihDAg\\r\\nweVtBIP yQUkaihDAg\\r\\nazQeXn hXPfJrL\\r\\nV tulhZxeKgo\\r\\nzRwb yQUkaihDAg\\r\\nds mwjlDVaktK\\r\\nzRwb brAXY\\r\\nyQUkaihDAg brAXY\\r\\nB yQUkaihDAg\\r\\nAdIfP mwjlDVaktK\\r\\nbrAXY tulhZxeKgo\\r\\n', 'output': ['11\\r\\nAdIfP\\r\\nB\\r\\nJlmscIUOxO\\r\\nOfyLIUO\\r\\nV\\r\\nZuxr\\r\\nazQeXn\\r\\nbrAXY\\r\\nds\\r\\nuaMl\\r\\nweVtBIP\\r\\n']}, {'input': '5 10\\r\\nTaras\\r\\nNikita\\r\\nSergey\\r\\nAndrey\\r\\nRomka\\r\\nTaras Romka\\r\\nTaras Nikita\\r\\nTaras Sergey\\r\\nTaras Andrey\\r\\nRomka Nikita\\r\\nRomka Sergey\\r\\nRomka Andrey\\r\\nNikita Sergey\\r\\nNikita Andrey\\r\\nSergey Andrey\\r\\n', 'output': ['1\\r\\nAndrey\\r\\n']}]","id":130} {"description":"Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the first student with the second one as well as the second student with the first one.To restore order, Anna and Maria do the following. First, for each student Anna finds out what other students he is tied to. If a student is tied to exactly one other student, Anna reprimands him. Then Maria gathers in a single group all the students who have been just reprimanded. She kicks them out from the club. This group of students immediately leaves the club. These students takes with them the laces that used to tie them. Then again for every student Anna finds out how many other students he is tied to and so on. And they do so until Anna can reprimand at least one student.Determine how many groups of students will be kicked out of the club.","input_specification":"The first line contains two integers n and m \u2014 the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b \u2014 the numbers of students tied by the i-th lace (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n,\u2009a\u2009\u2260\u2009b). It is guaranteed that no two students are tied with more than one lace. No lace ties a student to himself.","output_specification":"Print the single number \u2014 the number of groups of students that will be kicked out from the club.","notes":"NoteIn the first sample Anna and Maria won't kick out any group of students \u2014 in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the two students from both ends of the chain (1 and 4), then \u2014 two other students from the chain (2 and 3). At that the students who are running by themselves will stay in the club.In the third sample Anna and Maria will momentarily kick out all students except for the fourth one and the process stops at that point. The correct answer is one.","sample_inputs":["3 3\n1 2\n2 3\n3 1","6 3\n1 2\n2 3\n3 4","6 5\n1 4\n2 4\n3 4\n5 4\n6 4"],"sample_outputs":["0","2","1"],"src_uid":"f8315dc903b0542c453cab4577bcb20d","lang_cluster":"Python","difficulty":1200,"human_solution":"r = lambda: raw_input().strip()\n\nn,m = map(int,r().split())\nties = [map(int,r().split()) for _ in xrange(m)]\ncount = 0\nwhile len(ties)>0:\n all_ties = []\n l1 = len(ties)\n for t in ties:\n all_ties.append(t[0])\n all_ties.append(t[1])\n for i in xrange(n):\n if all_ties.count(i+1)==1:\n for t in xrange(len(ties)):\n if ties[t][0] == i+1 or ties[t][1] == i+1:\n ties.remove(ties[t])\n break\n l2 = len(ties)\n if l1==l2:\n break\n count += 1\nprint count\n","testcases":"[{'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '6 3\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '6 5\\r\\n1 4\\r\\n2 4\\r\\n3 4\\r\\n5 4\\r\\n6 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 5\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '5 4\\r\\n1 4\\r\\n4 3\\r\\n4 5\\r\\n5 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '11 10\\r\\n1 2\\r\\n1 3\\r\\n3 4\\r\\n1 5\\r\\n5 6\\r\\n6 7\\r\\n1 8\\r\\n8 9\\r\\n9 10\\r\\n10 11\\r\\n', 'output': ['4\\r\\n']}, {'input': '7 7\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n1 4\\r\\n4 5\\r\\n4 6\\r\\n4 7\\r\\n', 'output': ['2\\r\\n']}, {'input': '12 49\\r\\n6 3\\r\\n12 9\\r\\n10 11\\r\\n3 5\\r\\n10 2\\r\\n6 9\\r\\n8 5\\r\\n6 12\\r\\n7 3\\r\\n3 12\\r\\n3 2\\r\\n5 6\\r\\n7 5\\r\\n9 2\\r\\n11 1\\r\\n7 6\\r\\n5 4\\r\\n8 7\\r\\n12 5\\r\\n5 11\\r\\n8 9\\r\\n10 3\\r\\n6 2\\r\\n10 4\\r\\n9 10\\r\\n9 11\\r\\n11 3\\r\\n5 9\\r\\n11 6\\r\\n10 8\\r\\n7 9\\r\\n10 7\\r\\n4 6\\r\\n3 8\\r\\n4 11\\r\\n12 2\\r\\n4 9\\r\\n2 11\\r\\n7 11\\r\\n1 5\\r\\n7 2\\r\\n8 1\\r\\n4 12\\r\\n9 1\\r\\n4 2\\r\\n8 2\\r\\n11 12\\r\\n3 1\\r\\n1 6\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 29\\r\\n4 5\\r\\n1 7\\r\\n4 2\\r\\n3 8\\r\\n7 6\\r\\n8 10\\r\\n10 6\\r\\n4 1\\r\\n10 1\\r\\n6 2\\r\\n7 4\\r\\n7 10\\r\\n2 7\\r\\n9 8\\r\\n5 10\\r\\n2 5\\r\\n8 5\\r\\n4 9\\r\\n2 8\\r\\n5 7\\r\\n4 8\\r\\n7 3\\r\\n6 5\\r\\n1 3\\r\\n1 9\\r\\n10 4\\r\\n10 9\\r\\n10 2\\r\\n2 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '9 33\\r\\n5 7\\r\\n5 9\\r\\n9 6\\r\\n9 1\\r\\n7 4\\r\\n3 5\\r\\n7 8\\r\\n8 6\\r\\n3 6\\r\\n8 2\\r\\n3 8\\r\\n1 6\\r\\n1 8\\r\\n1 4\\r\\n4 2\\r\\n1 2\\r\\n2 5\\r\\n3 4\\r\\n8 5\\r\\n2 6\\r\\n3 1\\r\\n1 5\\r\\n1 7\\r\\n3 2\\r\\n5 4\\r\\n9 4\\r\\n3 9\\r\\n7 3\\r\\n6 4\\r\\n9 8\\r\\n7 9\\r\\n8 4\\r\\n6 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '7 8\\r\\n5 7\\r\\n2 7\\r\\n1 6\\r\\n1 3\\r\\n3 7\\r\\n6 3\\r\\n6 4\\r\\n2 6\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 15\\r\\n3 1\\r\\n4 5\\r\\n1 4\\r\\n6 2\\r\\n3 5\\r\\n6 3\\r\\n1 6\\r\\n1 5\\r\\n2 3\\r\\n2 5\\r\\n6 4\\r\\n5 6\\r\\n4 2\\r\\n1 2\\r\\n3 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '7 11\\r\\n5 3\\r\\n6 5\\r\\n6 4\\r\\n1 6\\r\\n7 1\\r\\n2 6\\r\\n7 5\\r\\n2 5\\r\\n3 1\\r\\n3 4\\r\\n2 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '95 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '100 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '62 30\\r\\n29 51\\r\\n29 55\\r\\n4 12\\r\\n53 25\\r\\n36 28\\r\\n32 11\\r\\n29 11\\r\\n47 9\\r\\n21 8\\r\\n25 4\\r\\n51 19\\r\\n26 56\\r\\n22 21\\r\\n37 9\\r\\n9 33\\r\\n7 25\\r\\n16 7\\r\\n40 49\\r\\n15 21\\r\\n49 58\\r\\n34 30\\r\\n20 46\\r\\n62 48\\r\\n53 57\\r\\n33 6\\r\\n60 37\\r\\n41 34\\r\\n62 36\\r\\n36 43\\r\\n11 39\\r\\n', 'output': ['2\\r\\n']}, {'input': '56 25\\r\\n12 40\\r\\n31 27\\r\\n18 40\\r\\n1 43\\r\\n9 10\\r\\n25 47\\r\\n27 29\\r\\n26 28\\r\\n19 38\\r\\n19 40\\r\\n22 14\\r\\n21 51\\r\\n29 31\\r\\n55 29\\r\\n51 33\\r\\n20 17\\r\\n24 15\\r\\n3 48\\r\\n31 56\\r\\n15 29\\r\\n49 42\\r\\n50 4\\r\\n22 42\\r\\n25 17\\r\\n18 51\\r\\n', 'output': ['3\\r\\n']}, {'input': '51 29\\r\\n36 30\\r\\n37 45\\r\\n4 24\\r\\n40 18\\r\\n47 35\\r\\n15 1\\r\\n30 38\\r\\n15 18\\r\\n32 40\\r\\n34 42\\r\\n2 47\\r\\n35 21\\r\\n25 28\\r\\n13 1\\r\\n13 28\\r\\n36 1\\r\\n46 47\\r\\n22 17\\r\\n41 45\\r\\n43 45\\r\\n40 15\\r\\n29 35\\r\\n47 15\\r\\n30 21\\r\\n9 14\\r\\n18 38\\r\\n18 50\\r\\n42 10\\r\\n31 41\\r\\n', 'output': ['3\\r\\n']}, {'input': '72 45\\r\\n5 15\\r\\n8 18\\r\\n40 25\\r\\n71 66\\r\\n67 22\\r\\n6 44\\r\\n16 25\\r\\n8 23\\r\\n19 70\\r\\n26 34\\r\\n48 15\\r\\n24 2\\r\\n54 68\\r\\n44 43\\r\\n17 37\\r\\n49 19\\r\\n71 49\\r\\n34 38\\r\\n59 1\\r\\n65 70\\r\\n11 54\\r\\n5 11\\r\\n15 31\\r\\n29 50\\r\\n48 16\\r\\n70 57\\r\\n25 59\\r\\n2 59\\r\\n56 12\\r\\n66 62\\r\\n24 16\\r\\n46 27\\r\\n45 67\\r\\n68 43\\r\\n31 11\\r\\n31 30\\r\\n8 44\\r\\n64 33\\r\\n38 44\\r\\n54 10\\r\\n13 9\\r\\n7 51\\r\\n25 4\\r\\n40 70\\r\\n26 65\\r\\n', 'output': ['5\\r\\n']}, {'input': '56 22\\r\\n17 27\\r\\n48 49\\r\\n29 8\\r\\n47 20\\r\\n32 7\\r\\n44 5\\r\\n14 39\\r\\n5 13\\r\\n40 2\\r\\n50 42\\r\\n38 9\\r\\n18 37\\r\\n16 44\\r\\n21 32\\r\\n21 39\\r\\n37 54\\r\\n19 46\\r\\n30 47\\r\\n17 13\\r\\n30 31\\r\\n49 16\\r\\n56 7\\r\\n', 'output': ['4\\r\\n']}, {'input': '81 46\\r\\n53 58\\r\\n31 14\\r\\n18 54\\r\\n43 61\\r\\n57 65\\r\\n6 38\\r\\n49 5\\r\\n6 40\\r\\n6 10\\r\\n17 72\\r\\n27 48\\r\\n58 39\\r\\n21 75\\r\\n21 43\\r\\n78 20\\r\\n34 4\\r\\n15 35\\r\\n74 48\\r\\n76 15\\r\\n49 38\\r\\n46 51\\r\\n78 9\\r\\n80 5\\r\\n26 42\\r\\n64 31\\r\\n46 72\\r\\n1 29\\r\\n20 17\\r\\n32 45\\r\\n53 43\\r\\n24 5\\r\\n52 59\\r\\n3 80\\r\\n78 19\\r\\n61 17\\r\\n80 12\\r\\n17 8\\r\\n63 2\\r\\n8 4\\r\\n44 10\\r\\n53 72\\r\\n18 60\\r\\n68 15\\r\\n17 58\\r\\n79 71\\r\\n73 35\\r\\n', 'output': ['4\\r\\n']}, {'input': '82 46\\r\\n64 43\\r\\n32 24\\r\\n57 30\\r\\n24 46\\r\\n70 12\\r\\n23 41\\r\\n63 39\\r\\n46 70\\r\\n4 61\\r\\n19 12\\r\\n39 79\\r\\n14 28\\r\\n37 3\\r\\n12 27\\r\\n15 20\\r\\n35 39\\r\\n25 64\\r\\n59 16\\r\\n68 63\\r\\n37 14\\r\\n76 7\\r\\n67 29\\r\\n9 5\\r\\n14 55\\r\\n46 26\\r\\n71 79\\r\\n47 42\\r\\n5 55\\r\\n18 45\\r\\n28 40\\r\\n44 78\\r\\n74 9\\r\\n60 53\\r\\n44 19\\r\\n52 81\\r\\n65 52\\r\\n40 13\\r\\n40 19\\r\\n43 1\\r\\n24 23\\r\\n68 9\\r\\n16 20\\r\\n70 14\\r\\n41 40\\r\\n29 10\\r\\n45 65\\r\\n', 'output': ['8\\r\\n']}, {'input': '69 38\\r\\n63 35\\r\\n52 17\\r\\n43 69\\r\\n2 57\\r\\n12 5\\r\\n26 36\\r\\n13 10\\r\\n16 68\\r\\n5 18\\r\\n5 41\\r\\n10 4\\r\\n60 9\\r\\n39 22\\r\\n39 28\\r\\n53 57\\r\\n13 52\\r\\n66 38\\r\\n49 61\\r\\n12 19\\r\\n27 46\\r\\n67 7\\r\\n25 8\\r\\n23 58\\r\\n52 34\\r\\n29 2\\r\\n2 42\\r\\n8 53\\r\\n57 43\\r\\n68 11\\r\\n48 28\\r\\n56 19\\r\\n46 33\\r\\n63 21\\r\\n57 16\\r\\n68 59\\r\\n67 34\\r\\n28 43\\r\\n56 36\\r\\n', 'output': ['4\\r\\n']}, {'input': '75 31\\r\\n32 50\\r\\n52 8\\r\\n21 9\\r\\n68 35\\r\\n12 72\\r\\n47 26\\r\\n38 58\\r\\n40 55\\r\\n31 70\\r\\n53 75\\r\\n44 1\\r\\n65 22\\r\\n33 22\\r\\n33 29\\r\\n14 39\\r\\n1 63\\r\\n16 52\\r\\n70 15\\r\\n12 27\\r\\n63 31\\r\\n47 9\\r\\n71 31\\r\\n43 17\\r\\n43 49\\r\\n8 26\\r\\n11 39\\r\\n9 22\\r\\n30 45\\r\\n65 47\\r\\n32 9\\r\\n60 70\\r\\n', 'output': ['4\\r\\n']}, {'input': '77 41\\r\\n48 45\\r\\n50 36\\r\\n6 69\\r\\n70 3\\r\\n22 21\\r\\n72 6\\r\\n54 3\\r\\n49 31\\r\\n2 23\\r\\n14 59\\r\\n68 58\\r\\n4 54\\r\\n60 12\\r\\n63 60\\r\\n44 24\\r\\n28 24\\r\\n40 8\\r\\n5 1\\r\\n13 24\\r\\n29 15\\r\\n19 76\\r\\n70 50\\r\\n65 71\\r\\n23 33\\r\\n58 16\\r\\n50 42\\r\\n71 28\\r\\n58 54\\r\\n24 73\\r\\n6 17\\r\\n29 13\\r\\n60 4\\r\\n42 4\\r\\n21 60\\r\\n77 39\\r\\n57 9\\r\\n51 19\\r\\n61 6\\r\\n49 36\\r\\n24 32\\r\\n41 66\\r\\n', 'output': ['3\\r\\n']}, {'input': '72 39\\r\\n9 44\\r\\n15 12\\r\\n2 53\\r\\n34 18\\r\\n41 70\\r\\n54 72\\r\\n39 19\\r\\n26 7\\r\\n4 54\\r\\n53 59\\r\\n46 49\\r\\n70 6\\r\\n9 10\\r\\n64 51\\r\\n31 60\\r\\n61 53\\r\\n59 71\\r\\n9 60\\r\\n67 16\\r\\n4 16\\r\\n34 3\\r\\n2 61\\r\\n16 23\\r\\n34 6\\r\\n10 18\\r\\n13 38\\r\\n66 40\\r\\n59 9\\r\\n40 14\\r\\n38 24\\r\\n31 48\\r\\n7 69\\r\\n20 39\\r\\n49 52\\r\\n32 67\\r\\n61 35\\r\\n62 45\\r\\n37 54\\r\\n5 27\\r\\n', 'output': ['8\\r\\n']}, {'input': '96 70\\r\\n30 37\\r\\n47 56\\r\\n19 79\\r\\n15 28\\r\\n2 43\\r\\n43 54\\r\\n59 75\\r\\n42 22\\r\\n38 18\\r\\n18 14\\r\\n47 41\\r\\n60 29\\r\\n35 11\\r\\n90 4\\r\\n14 41\\r\\n11 71\\r\\n41 24\\r\\n68 28\\r\\n45 92\\r\\n14 15\\r\\n34 63\\r\\n77 32\\r\\n67 38\\r\\n36 8\\r\\n37 4\\r\\n58 95\\r\\n68 84\\r\\n69 81\\r\\n35 23\\r\\n56 63\\r\\n78 91\\r\\n35 44\\r\\n66 63\\r\\n80 19\\r\\n87 88\\r\\n28 14\\r\\n62 35\\r\\n24 23\\r\\n83 37\\r\\n54 89\\r\\n14 40\\r\\n9 35\\r\\n94 9\\r\\n56 46\\r\\n92 70\\r\\n16 58\\r\\n96 31\\r\\n53 23\\r\\n56 5\\r\\n36 42\\r\\n89 77\\r\\n29 51\\r\\n26 13\\r\\n46 70\\r\\n25 56\\r\\n95 96\\r\\n3 51\\r\\n76 8\\r\\n36 82\\r\\n44 85\\r\\n54 56\\r\\n89 67\\r\\n32 5\\r\\n82 78\\r\\n33 65\\r\\n43 28\\r\\n35 1\\r\\n94 13\\r\\n26 24\\r\\n10 51\\r\\n', 'output': ['4\\r\\n']}, {'input': '76 49\\r\\n15 59\\r\\n23 26\\r\\n57 48\\r\\n49 51\\r\\n42 76\\r\\n36 40\\r\\n37 40\\r\\n29 15\\r\\n28 71\\r\\n47 70\\r\\n27 39\\r\\n76 21\\r\\n55 16\\r\\n21 18\\r\\n19 1\\r\\n25 31\\r\\n51 71\\r\\n54 42\\r\\n28 9\\r\\n61 69\\r\\n33 9\\r\\n18 19\\r\\n58 51\\r\\n51 45\\r\\n29 34\\r\\n9 67\\r\\n26 8\\r\\n70 37\\r\\n11 62\\r\\n24 22\\r\\n59 76\\r\\n67 17\\r\\n59 11\\r\\n54 1\\r\\n12 57\\r\\n23 3\\r\\n46 47\\r\\n37 20\\r\\n65 9\\r\\n51 12\\r\\n31 19\\r\\n56 13\\r\\n58 22\\r\\n26 59\\r\\n39 76\\r\\n27 11\\r\\n48 64\\r\\n59 35\\r\\n44 75\\r\\n', 'output': ['5\\r\\n']}, {'input': '52 26\\r\\n29 41\\r\\n16 26\\r\\n18 48\\r\\n31 17\\r\\n37 42\\r\\n26 1\\r\\n11 7\\r\\n29 6\\r\\n23 17\\r\\n12 47\\r\\n34 23\\r\\n41 16\\r\\n15 35\\r\\n25 21\\r\\n45 7\\r\\n52 2\\r\\n37 10\\r\\n28 19\\r\\n1 27\\r\\n30 47\\r\\n42 35\\r\\n50 30\\r\\n30 34\\r\\n19 30\\r\\n42 25\\r\\n47 31\\r\\n', 'output': ['3\\r\\n']}, {'input': '86 48\\r\\n59 34\\r\\n21 33\\r\\n45 20\\r\\n62 23\\r\\n4 68\\r\\n2 65\\r\\n63 26\\r\\n64 20\\r\\n51 34\\r\\n64 21\\r\\n68 78\\r\\n61 80\\r\\n81 3\\r\\n38 39\\r\\n47 48\\r\\n24 34\\r\\n44 71\\r\\n72 78\\r\\n50 2\\r\\n13 51\\r\\n82 78\\r\\n11 74\\r\\n14 48\\r\\n2 75\\r\\n49 55\\r\\n63 85\\r\\n20 85\\r\\n4 53\\r\\n51 15\\r\\n11 67\\r\\n1 15\\r\\n2 64\\r\\n10 81\\r\\n6 7\\r\\n68 18\\r\\n84 28\\r\\n77 69\\r\\n10 36\\r\\n15 14\\r\\n32 86\\r\\n16 79\\r\\n26 13\\r\\n38 55\\r\\n47 43\\r\\n47 39\\r\\n45 37\\r\\n58 81\\r\\n42 35\\r\\n', 'output': ['8\\r\\n']}, {'input': '58 29\\r\\n27 24\\r\\n40 52\\r\\n51 28\\r\\n44 50\\r\\n7 28\\r\\n14 53\\r\\n10 16\\r\\n16 45\\r\\n8 56\\r\\n35 26\\r\\n39 6\\r\\n6 14\\r\\n45 22\\r\\n35 13\\r\\n20 17\\r\\n42 6\\r\\n37 21\\r\\n4 11\\r\\n26 56\\r\\n54 55\\r\\n3 57\\r\\n40 3\\r\\n55 27\\r\\n4 51\\r\\n35 29\\r\\n50 16\\r\\n47 7\\r\\n48 20\\r\\n1 37\\r\\n', 'output': ['3\\r\\n']}, {'input': '51 23\\r\\n46 47\\r\\n31 27\\r\\n1 20\\r\\n49 16\\r\\n2 10\\r\\n29 47\\r\\n13 27\\r\\n34 26\\r\\n31 2\\r\\n28 20\\r\\n17 40\\r\\n39 4\\r\\n29 26\\r\\n28 44\\r\\n3 39\\r\\n50 12\\r\\n19 1\\r\\n30 21\\r\\n41 23\\r\\n2 29\\r\\n16 3\\r\\n49 28\\r\\n49 41\\r\\n', 'output': ['4\\r\\n']}, {'input': '75 43\\r\\n46 34\\r\\n33 12\\r\\n51 39\\r\\n47 74\\r\\n68 64\\r\\n40 46\\r\\n20 51\\r\\n47 19\\r\\n4 5\\r\\n57 59\\r\\n12 26\\r\\n68 65\\r\\n38 42\\r\\n73 37\\r\\n5 74\\r\\n36 61\\r\\n8 18\\r\\n58 33\\r\\n34 73\\r\\n42 43\\r\\n10 49\\r\\n70 50\\r\\n49 18\\r\\n24 53\\r\\n71 73\\r\\n44 24\\r\\n49 56\\r\\n24 29\\r\\n44 67\\r\\n70 46\\r\\n57 25\\r\\n73 63\\r\\n3 51\\r\\n30 71\\r\\n41 44\\r\\n17 69\\r\\n17 18\\r\\n19 68\\r\\n42 7\\r\\n11 51\\r\\n1 5\\r\\n72 23\\r\\n65 53\\r\\n', 'output': ['5\\r\\n']}]","id":131} {"description":"A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volume in each of the n mugs must be the same.Polycarpus has already began the process and he partially emptied the Ber-Cola bottle. Now the first mug has a1 milliliters of the drink, the second one has a2 milliliters and so on. The bottle has b milliliters left and Polycarpus plans to pour them into the mugs so that the main equation was fulfilled.Write a program that would determine what volume of the drink Polycarpus needs to add into each mug to ensure that the following two conditions were fulfilled simultaneously: there were b milliliters poured in total. That is, the bottle need to be emptied; after the process is over, the volumes of the drink in the mugs should be equal. ","input_specification":"The first line contains a pair of integers n, b (2\u2009\u2264\u2009n\u2009\u2264\u2009100,\u20091\u2009\u2264\u2009b\u2009\u2264\u2009100), where n is the total number of friends in the group and b is the current volume of drink in the bottle. The second line contains a sequence of integers a1,\u2009a2,\u2009...,\u2009an (0\u2009\u2264\u2009ai\u2009\u2264\u2009100), where ai is the current volume of drink in the i-th mug.","output_specification":"Print a single number \"-1\" (without the quotes), if there is no solution. Otherwise, print n float numbers c1,\u2009c2,\u2009...,\u2009cn, where ci is the volume of the drink to add in the i-th mug. Print the numbers with no less than 6 digits after the decimal point, print each ci on a single line. Polycarpus proved that if a solution exists then it is unique. Russian locale is installed by default on the testing computer. Make sure that your solution use the point to separate the integer part of a real number from the decimal, not a comma.","notes":null,"sample_inputs":["5 50\n1 2 3 4 5","2 2\n1 100"],"sample_outputs":["12.000000\n11.000000\n10.000000\n9.000000\n8.000000","-1"],"src_uid":"65fea461d3caa5a932d1e2c13e99a59e","lang_cluster":"Python","difficulty":1100,"human_solution":"x=[int(i) for i in input().split()]\nn=x[0]\ny=[int(i) for i in input().split()]\nif x[1]= n\/2:\n ans = 0\n break\n elif key in back and front[key] + back[key] >= n\/2:\n m[key] = math.ceil(n\/2) - front[key]\n\nelse:\n if len(m) > 0:\n ans = min(sorted(m.values()))\n else:\n for key, value in back.items():\n if value >= n\/2:\n ans = math.ceil(n\/2)\n break\n else:\n ans = -1\nprint(ans)\n","testcases":"[{'input': '3\\r\\n4 7\\r\\n4 7\\r\\n7 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n4 7\\r\\n7 4\\r\\n2 11\\r\\n9 7\\r\\n1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n1 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n1 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 8\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n2 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n7 7\\r\\n1 2\\r\\n2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n1 1\\r\\n2 5\\r\\n3 6\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4\\r\\n1000000000 1000000000\\r\\n999999999 1000000000\\r\\n999999997 999999998\\r\\n47 74\\r\\n', 'output': ['1\\r\\n']}, {'input': '6\\r\\n1 2\\r\\n3 1\\r\\n4 7\\r\\n4 1\\r\\n9 1\\r\\n7 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '4\\r\\n1 2\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n4 7\\r\\n7 4\\r\\n4 7\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n1000000000 999999999\\r\\n47 74\\r\\n47474 75785445\\r\\n8798878 458445\\r\\n1 2\\r\\n888888888 777777777\\r\\n99999999 1000000000\\r\\n9999999 1000000000\\r\\n999999 1000000000\\r\\n99999 1000000000\\r\\n', 'output': ['4\\r\\n']}, {'input': '10\\r\\n9 1000000000\\r\\n47 74\\r\\n47474 75785445\\r\\n8798878 458445\\r\\n1 2\\r\\n888888888 777777777\\r\\n99999999 1000000000\\r\\n9999999 1000000000\\r\\n999999 1000000000\\r\\n99999 1000000000\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n1 10\\r\\n1 10\\r\\n1 1\\r\\n7 8\\r\\n6 7\\r\\n9 5\\r\\n4 1\\r\\n2 3\\r\\n3 10\\r\\n2 8\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10\\r\\n262253762 715261903\\r\\n414831157 8354405\\r\\n419984358 829693421\\r\\n376600467 175941985\\r\\n367533995 350629286\\r\\n681027822 408529849\\r\\n654503328 717740407\\r\\n539773033 704670473\\r\\n55322828 380422378\\r\\n46174018 186723478\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10\\r\\n2 2\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n1 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '12\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '47\\r\\n53 63\\r\\n43 57\\r\\n69 52\\r\\n66 47\\r\\n74 5\\r\\n5 2\\r\\n6 56\\r\\n19 27\\r\\n46 27\\r\\n31 45\\r\\n41 38\\r\\n20 20\\r\\n69 43\\r\\n17 74\\r\\n39 43\\r\\n28 70\\r\\n73 24\\r\\n73 59\\r\\n23 11\\r\\n56 49\\r\\n51 37\\r\\n70 16\\r\\n66 36\\r\\n4 7\\r\\n1 49\\r\\n7 65\\r\\n38 5\\r\\n47 74\\r\\n34 38\\r\\n17 22\\r\\n59 3\\r\\n70 40\\r\\n21 15\\r\\n10 5\\r\\n17 30\\r\\n9 12\\r\\n28 48\\r\\n70 42\\r\\n39 70\\r\\n18 53\\r\\n71 49\\r\\n66 25\\r\\n37 51\\r\\n10 62\\r\\n55 7\\r\\n18 53\\r\\n40 50\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n1 1\\r\\n2 2\\r\\n2 1\\r\\n2 1\\r\\n1 1\\r\\n1 1\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n1 1\\r\\n2 1\\r\\n1 1\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n1 1\\r\\n1 1\\r\\n2 2\\r\\n2 2\\r\\n2 1\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n1 1\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n2 1\\r\\n2 1\\r\\n2 2\\r\\n1 1\\r\\n1 1\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n2 2\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n2 1\\r\\n1 1\\r\\n2 1\\r\\n2 1\\r\\n1 1\\r\\n1 2\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n1 2\\r\\n2 1\\r\\n1 1\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n1 2\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n2 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n2 3\\r\\n4 5\\r\\n6 7\\r\\n8 9\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n1000000000 999999999\\r\\n1000000000 999999999\\r\\n1000000000 999999999\\r\\n1000000000 999999999\\r\\n1000000000 999999999\\r\\n1000000000 999999999\\r\\n1000000000 999999999\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n47 74\\r\\n47 85874\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n5 8\\r\\n9 10\\r\\n5 17\\r\\n5 24\\r\\n1 147\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 7\\r\\n2 7\\r\\n3 7\\r\\n4 7\\r\\n5 7\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n1 10\\r\\n2 10\\r\\n3 10\\r\\n4 10\\r\\n5 10\\r\\n', 'output': ['3\\r\\n']}, {'input': '3\\r\\n2 1\\r\\n3 1\\r\\n4 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n1 2\\r\\n1 3\\r\\n4 1\\r\\n5 1\\r\\n6 7\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n4 7\\r\\n4 7\\r\\n2 7\\r\\n9 7\\r\\n1 1\\r\\n', 'output': ['3\\r\\n']}, {'input': '8\\r\\n1 2\\r\\n2 1\\r\\n2 1\\r\\n3 1\\r\\n4 2\\r\\n5 2\\r\\n6 2\\r\\n7 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n98751 197502\\r\\n296253 395004\\r\\n493755 592506\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5\\r\\n1 5\\r\\n2 5\\r\\n3 5\\r\\n4 7\\r\\n2 5\\r\\n', 'output': ['3\\r\\n']}, {'input': '10\\r\\n1 10\\r\\n2 10\\r\\n3 10\\r\\n4 10\\r\\n5 10\\r\\n10 1\\r\\n10 2\\r\\n10 3\\r\\n10 4\\r\\n10 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n1 2\\r\\n1 2\\r\\n1 2\\r\\n3 1\\r\\n3 1\\r\\n3 1\\r\\n2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 6\\r\\n2 6\\r\\n3 6\\r\\n4 6\\r\\n5 6\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n1 6\\r\\n2 6\\r\\n3 6\\r\\n4 4\\r\\n5 5\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n1 1\\r\\n1 1\\r\\n2 2\\r\\n2 2\\r\\n3 3\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4\\r\\n1 5\\r\\n2 5\\r\\n3 5\\r\\n4 4\\r\\n', 'output': ['2\\r\\n']}]","id":135} {"description":"Vasya, like many others, likes to participate in a variety of sweepstakes and lotteries. Now he collects wrappings from a famous chocolate bar \"Jupiter\". According to the sweepstake rules, each wrapping has an integer written on it \u2014 the number of points that the participant adds to his score as he buys the bar. After a participant earns a certain number of points, he can come to the prize distribution center and exchange the points for prizes. When somebody takes a prize, the prize's cost is simply subtracted from the number of his points.Vasya didn't only bought the bars, he also kept a record of how many points each wrapping cost. Also, he remembers that he always stucks to the greedy strategy \u2014 as soon as he could take at least one prize, he went to the prize distribution centre and exchanged the points for prizes. Moreover, if he could choose between multiple prizes, he chose the most expensive one. If after an exchange Vasya had enough points left to get at least one more prize, then he continued to exchange points.The sweepstake has the following prizes (the prizes are sorted by increasing of their cost): a mug (costs a points), a towel (costs b points), a bag (costs c points), a bicycle (costs d points), a car (costs e points). Now Vasya wants to recollect what prizes he has received. You know sequence p1,\u2009p2,\u2009...,\u2009pn, where pi is the number of points Vasya got for the i-th bar. The sequence of points is given in the chronological order. You also know numbers a, b, c, d, e. Your task is to find, how many prizes Vasya received, what prizes they are and how many points he's got left after all operations are completed.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u200950) \u2014 the number of chocolate bar wrappings that brought points to Vasya. The second line contains space-separated integers p1,\u2009p2,\u2009...,\u2009pn (1\u2009\u2264\u2009pi\u2009\u2264\u2009109). The third line contains 5 integers a, b, c, d, e (1\u2009\u2264\u2009a\u2009<\u2009b\u2009<\u2009c\u2009<\u2009d\u2009<\u2009e\u2009\u2264\u2009109) \u2014 the prizes' costs.","output_specification":"Print on the first line 5 integers, separated by a space \u2014 the number of mugs, towels, bags, bicycles and cars that Vasya has got, respectively. On the second line print a single integer \u2014 the number of points Vasya will have left after all operations of exchange are completed. Please, do not use the %lld specifier to read or write 64-bit integers in \u0421++. It is preferred to use the cin, cout streams or the %I64d specifier.","notes":"NoteIn the first sample Vasya gets 3 points after eating the first chocolate bar. Then he exchanges 2 points and gets a mug. Vasya wins a bag after eating the second chocolate bar. Then he wins a towel after eating the third chocolate bar. After all chocolate bars 3\u2009-\u20092\u2009+\u200910\u2009-\u200910\u2009+\u20094\u2009-\u20094\u2009=\u20091 points remains.","sample_inputs":["3\n3 10 4\n2 4 10 15 20","4\n10 4 39 2\n3 5 10 11 12"],"sample_outputs":["1 1 1 0 0 \n1","3 0 1 0 3 \n0"],"src_uid":"1ae2942b72ebb7c55359c41e141900d7","lang_cluster":"Python","difficulty":1200,"human_solution":"n = int(raw_input())\npts = [int(i) for i in raw_input().split()]\ngoods = [int(i) for i in raw_input().split()]\n\nleft = 0\ngets = [0]*5\nfor p in pts:\n left += p\n for i in xrange(4, -1, -1):\n gets[i] += left\/goods[i]\n left %= goods[i]\nprint gets[0], gets[1], gets[2], gets[3], gets[4]\nprint left\n","testcases":"[{'input': '3\\r\\n3 10 4\\r\\n2 4 10 15 20\\r\\n', 'output': ['1 1 1 0 0 \\r\\n1\\r\\n']}, {'input': '4\\r\\n10 4 39 2\\r\\n3 5 10 11 12\\r\\n', 'output': ['3 0 1 0 3 \\r\\n0\\r\\n']}, {'input': '1\\r\\n45\\r\\n1 2 3 4 5\\r\\n', 'output': ['0 0 0 0 9 \\r\\n0\\r\\n']}, {'input': '1\\r\\n50\\r\\n1 2 4 5 6\\r\\n', 'output': ['0 1 0 0 8 \\r\\n0\\r\\n']}, {'input': '1\\r\\n6\\r\\n1 2 4 6 7\\r\\n', 'output': ['0 0 0 1 0 \\r\\n0\\r\\n']}, {'input': '1\\r\\n11\\r\\n1 2 3 6 8\\r\\n', 'output': ['0 0 1 0 1 \\r\\n0\\r\\n']}, {'input': '45\\r\\n54672703 354223499 798425228 192616902 934526477 130046515 120969797 1128116 221465324 487958664 211577865 653388287 538234 467693667 387627267 811104156 26715905 108515494 288069433 106690737 712686358 683861047 56548860 385125409 178325602 329144983 320699771 611743158 176982141 882718242 574909811 18981354 497482742 126502373 342328066 970474066 352019823 333022487 625437081 18635432 354739941 509867062 781623566 885791347 684953358\\r\\n1 2 3 4 5\\r\\n', 'output': ['10 15 9 7 3554511651 \\r\\n0\\r\\n']}, {'input': '5\\r\\n43 4 16 36 41\\r\\n5 6 7 8 9\\r\\n', 'output': ['0 0 2 0 14 \\r\\n0\\r\\n']}, {'input': '5\\r\\n6 6 47 32 28\\r\\n1 2 6 9 11\\r\\n', 'output': ['2 1 3 1 8 \\r\\n0\\r\\n']}, {'input': '5\\r\\n30 25 31 47 40\\r\\n1 3 6 13 20\\r\\n', 'output': ['6 3 3 0 7 \\r\\n0\\r\\n']}, {'input': '10\\r\\n588141495 24894836 162095938 610922780 767639361 522148294 556163403 302924834 618125209 410537083\\r\\n1 2 3 4 5\\r\\n', 'output': ['2 0 3 3 912718642 \\r\\n0\\r\\n']}, {'input': '10\\r\\n5 37 8 21 10 13 36 4 40 26\\r\\n3 5 6 7 10\\r\\n', 'output': ['1 2 1 3 16 \\r\\n0\\r\\n']}, {'input': '10\\r\\n3 25 17 20 25 26 15 35 47 16\\r\\n5 8 11 14 15\\r\\n', 'output': ['1 1 3 0 12 \\r\\n3\\r\\n']}, {'input': '10\\r\\n1 10 34 9 49 42 45 8 42 7\\r\\n2 6 11 13 14\\r\\n', 'output': ['5 5 1 0 14 \\r\\n0\\r\\n']}, {'input': '15\\r\\n13 44 13 13 38 25 43 25 40 28 5 23 25 41 6\\r\\n1 2 3 4 5\\r\\n', 'output': ['2 0 7 1 71 \\r\\n0\\r\\n']}, {'input': '15\\r\\n195995511 767544072 924890005 342377584 638748004 904551320 222776859 921356712 204326392 225923474 90658415 610365756 971907038 41090763 853207872\\r\\n5 7 8 9 10\\r\\n', 'output': ['3 0 3 2 791571972 \\r\\n0\\r\\n']}, {'input': '15\\r\\n14 19 5 16 11 22 40 7 13 21 24 26 49 22 26\\r\\n1 2 7 8 9\\r\\n', 'output': ['4 19 2 2 27 \\r\\n0\\r\\n']}, {'input': '15\\r\\n5 41 46 48 22 49 5 37 10 4 19 2 16 32 24\\r\\n2 11 15 18 20\\r\\n', 'output': ['30 1 2 1 12 \\r\\n1\\r\\n']}, {'input': '15\\r\\n50 12 36 11 38 28 4 11 29 34 22 46 43 2 29\\r\\n7 8 10 17 23\\r\\n', 'output': ['1 0 6 3 12 \\r\\n1\\r\\n']}, {'input': '15\\r\\n676837988 94471701 777591167 399710490 409807125 414445437 8315750 102835211 36239666 141260442 589733329 572072035 789807197 431009789 123234386\\r\\n20 39 45 46 48\\r\\n', 'output': ['5 2 1 0 115986906 \\r\\n2\\r\\n']}, {'input': '25\\r\\n26 29 17 11 35 21 11 22 17 24 41 44 27 34 42 24 44 3 8 25 23 6 16 41 2\\r\\n1 2 3 4 5\\r\\n', 'output': ['8 6 3 6 108 \\r\\n0\\r\\n']}, {'input': '25\\r\\n46 37 12 28 16 9 26 12 31 49 28 23 39 49 21 40 1 31 8 6 33 46 4 12 20\\r\\n5 6 7 8 10\\r\\n', 'output': ['1 2 2 3 57 \\r\\n2\\r\\n']}, {'input': '25\\r\\n48 3 22 29 40 21 28 31 22 16 17 3 47 37 38 15 16 27 41 48 17 11 22 15 15\\r\\n10 11 12 13 15\\r\\n', 'output': ['1 1 1 2 38 \\r\\n0\\r\\n']}, {'input': '49\\r\\n150841996 278751430 236103841 373294104 702072537 197872718 286517088 985323686 816421587 49928785 500114241 47334350 280942286 86728792 606895563 70696090 770589765 492645787 250574857 747511645 224488546 90659419 587972065 281798558 133719196 726362846 487266436 311413921 795767163 779792904 646907905 87907470 461431159 273590163 584894453 408543297 215247358 47704043 300890973 570589101 134168725 904691113 260042124 834209517 554685974 348043433 100083255 966828009 508031511\\r\\n1 2 3 4 5\\r\\n', 'output': ['12 7 12 7 4111778339 \\r\\n0\\r\\n']}, {'input': '25\\r\\n43 34 26 43 11 13 34 8 6 25 39 41 21 34 27 12 11 1 36 45 47 12 18 43 38\\r\\n1 2 10 24 25\\r\\n', 'output': ['11 46 19 0 15 \\r\\n0\\r\\n']}, {'input': '25\\r\\n38 30 40 7 7 18 43 5 29 49 50 9 4 18 30 35 21 22 15 33 9 31 32 22 6\\r\\n2 14 15 40 48\\r\\n', 'output': ['48 0 22 2 2 \\r\\n1\\r\\n']}, {'input': '50\\r\\n667406402 354775600 95220950 604569294 945922983 82947113 120853697 25192357 911801905 8804755 572528228 687361070 180664274 949243037 5283222 74969288 23627567 882714363 413386071 937062768 916521072 864701923 328941225 17876118 770879655 928962609 331124489 236187404 878629850 202558122 227732104 296494363 555832750 391788125 553472395 587090096 991781042 382982437 764518939 870576820 596491334 48319052 813976810 545209721 619789095 955839818 282149347 476620368 134986392 655856299\\r\\n1 2 3 4 5\\r\\n', 'output': ['3 13 11 9 4954444924 \\r\\n0\\r\\n']}, {'input': '50\\r\\n7 33 16 27 6 26 21 46 28 43 34 28 44 21 40 32 47 47 29 22 25 18 31 18 37 3 47 43 37 25 33 10 29 43 44 33 45 14 43 5 27 25 35 20 9 13 49 9 21 26\\r\\n3 4 5 7 9\\r\\n', 'output': ['4 6 6 15 138 \\r\\n1\\r\\n']}, {'input': '45\\r\\n18 21 6 3 48 23 5 26 37 6 49 6 42 19 8 39 38 47 36 22 13 21 14 32 43 42 5 30 35 36 16 34 32 8 1 37 14 29 39 50 25 26 10 25 39\\r\\n1 6 7 8 14\\r\\n', 'output': ['77 5 4 19 62 \\r\\n0\\r\\n']}, {'input': '45\\r\\n28 28 3 4 7 34 44 2 8 7 20 29 27 49 20 33 11 31 47 38 41 40 11 16 5 20 12 47 49 25 25 6 40 3 2 3 32 38 34 21 28 48 12 39 43\\r\\n9 10 12 14 20\\r\\n', 'output': ['4 5 2 8 44 \\r\\n8\\r\\n']}, {'input': '50\\r\\n17 30 29 29 50 42 15 18 34 10 30 3 44 11 4 35 42 8 14 41 30 4 11 1 3 23 7 28 35 6 24 37 6 12 8 7 36 40 41 26 13 46 15 40 32 34 15 28 46 31\\r\\n20 24 40 46 50\\r\\n', 'output': ['4 11 9 5 5 \\r\\n7\\r\\n']}]","id":136} {"description":"Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.We know that the i-th star on the pedal axle has ai (0\u2009<\u2009a1\u2009<\u2009a2\u2009<\u2009...\u2009<\u2009an) teeth, and the j-th star on the rear wheel axle has bj (0\u2009<\u2009b1\u2009<\u2009b2\u2009<\u2009...\u2009<\u2009bm) teeth. Any pair (i,\u2009j) (1\u2009\u2264\u2009i\u2009\u2264\u2009n;\u00a01\u2009\u2264\u2009j\u2009\u2264\u2009m) is called a gear and sets the indexes of stars to which the chain is currently attached. Gear (i,\u2009j) has a gear ratio, equal to the value .Since Vasya likes integers, he wants to find such gears (i,\u2009j), that their ratios are integers. On the other hand, Vasya likes fast driving, so among all \"integer\" gears (i,\u2009j) he wants to choose a gear with the maximum ratio. Help him to find the number of such gears.In the problem, fraction denotes division in real numbers, that is, no rounding is performed.","input_specification":"The first input line contains integer n (1\u2009\u2264\u2009n\u2009\u2264\u200950) \u2014 the number of stars on the bicycle's pedal axle. The second line contains n integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009104) in the order of strict increasing. The third input line contains integer m (1\u2009\u2264\u2009m\u2009\u2264\u200950) \u2014 the number of stars on the rear wheel axle. The fourth line contains m integers b1,\u2009b2,\u2009...,\u2009bm (1\u2009\u2264\u2009bi\u2009\u2264\u2009104) in the order of strict increasing. It is guaranteed that there exists at least one gear (i,\u2009j), that its gear ratio is an integer. The numbers on the lines are separated by spaces.","output_specification":"Print the number of \"integer\" gears with the maximum ratio among all \"integer\" gears.","notes":"NoteIn the first sample the maximum \"integer\" gear ratio equals 3. There are two gears that have such gear ratio. For one of them a1\u2009=\u20094,\u2009b1\u2009=\u200912, and for the other a2\u2009=\u20095,\u2009b3\u2009=\u200915.","sample_inputs":["2\n4 5\n3\n12 13 15","4\n1 2 3 4\n5\n10 11 12 13 14"],"sample_outputs":["2","1"],"src_uid":"102667eaa3aee012fef70f4192464674","lang_cluster":"Python","difficulty":900,"human_solution":"import collections as cl\n\n\nn, a = int(input()), map(int, input().split())\nm, b = int(input()), list(map(int, input().split()))\n\nans = cl.Counter([xb \/\/ xa for xa in a for xb in b if xb % xa == 0])\nprint(ans[max(ans.keys())])\n","testcases":"[{'input': '2\\r\\n4 5\\r\\n3\\r\\n12 13 15\\r\\n', 'output': ['2\\r\\n']}, {'input': '4\\r\\n1 2 3 4\\r\\n5\\r\\n10 11 12 13 14\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\n1\\r\\n1\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n1\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\n1\\r\\n2\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n3 7 11 13\\r\\n4\\r\\n51 119 187 221\\r\\n', 'output': ['4\\r\\n']}, {'input': '4\\r\\n2 3 4 5\\r\\n3\\r\\n1 2 3\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n6 12 13 20 48 53 74 92 96 97\\r\\n10\\r\\n1 21 32 36 47 54 69 75 95 97\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n5 9 10 14 15 17 19 22 24 26\\r\\n10\\r\\n2 11 17 19 21 22 24 25 27 28\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n24 53 56 126 354 432 442 740 795 856\\r\\n10\\r\\n273 438 494 619 689 711 894 947 954 958\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n3 4 6 7 8 10 14 16 19 20\\r\\n10\\r\\n3 4 5 7 8 10 15 16 18 20\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n1 6 8 14 15 17 25 27 34 39\\r\\n10\\r\\n1 8 16 17 19 22 32 39 44 50\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n5 21 22 23 25 32 35 36 38 39\\r\\n10\\r\\n3 7 8 9 18 21 23 24 36 38\\r\\n', 'output': ['4\\r\\n']}, {'input': '50\\r\\n5 8 13 16 19 20 21 22 24 27 28 29 30 32 33 34 35 43 45 48 50 51 54 55 58 59 60 61 62 65 70 71 72 76 78 79 80 81 83 84 85 87 89 91 92 94 97 98 99 100\\r\\n50\\r\\n2 3 5 6 7 10 15 16 17 20 23 28 29 30 31 34 36 37 40 42 45 46 48 54 55 56 58 59 61 62 69 70 71 72 75 76 78 82 84 85 86 87 88 89 90 91 92 97 99 100\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n3 5 6 8 9 11 13 19 21 23 24 32 34 35 42 50 51 52 56 58 59 69 70 72 73 75 76 77 78 80 83 88 90 95 96 100 101 102 108 109 113 119 124 135 138 141 142 143 145 150\\r\\n50\\r\\n5 8 10 11 18 19 23 30 35 43 51 53 55 58 63 68 69 71 77 78 79 82 83 86 88 89 91 92 93 94 96 102 103 105 109 110 113 114 116 123 124 126 127 132 133 135 136 137 142 149\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n6 16 24 25 27 33 36 40 51 60 62 65 71 72 75 77 85 87 91 93 98 102 103 106 117 118 120 121 122 123 125 131 134 136 143 148 155 157 160 161 164 166 170 178 184 187 188 192 194 197\\r\\n50\\r\\n5 9 17 23 27 34 40 44 47 59 62 70 81 82 87 88 89 90 98 101 102 110 113 114 115 116 119 122 124 128 130 137 138 140 144 150 152 155 159 164 166 169 171 175 185 186 187 189 190 193\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n14 22 23 31 32 35 48 63 76 79 88 97 101 102 103 104 106 113 114 115 116 126 136 138 145 152 155 156 162 170 172 173 179 180 182 203 208 210 212 222 226 229 231 232 235 237 245 246 247 248\\r\\n50\\r\\n2 5 6 16 28 44 45 46 54 55 56 63 72 80 87 93 94 96 97 100 101 103 132 135 140 160 164 165 167 168 173 180 182 185 186 192 194 198 199 202 203 211 213 216 217 227 232 233 236 245\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n14 19 33 35 38 41 51 54 69 70 71 73 76 80 84 94 102 104 105 106 107 113 121 128 131 168 180 181 187 191 195 201 205 207 210 216 220 238 249 251 263 271 272 275 281 283 285 286 291 294\\r\\n50\\r\\n2 3 5 20 21 35 38 40 43 48 49 52 55 64 73 77 82 97 109 113 119 121 125 132 137 139 145 146 149 180 182 197 203 229 234 241 244 251 264 271 274 281 284 285 287 291 292 293 294 298\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n2 4 5 16 18 19 22 23 25 26 34 44 48 54 67 79 80 84 92 110 116 133 138 154 163 171 174 202 205 218 228 229 234 245 247 249 250 263 270 272 274 275 277 283 289 310 312 334 339 342\\r\\n50\\r\\n1 5 17 18 25 37 46 47 48 59 67 75 80 83 84 107 115 122 137 141 159 162 175 180 184 204 221 224 240 243 247 248 249 258 259 260 264 266 269 271 274 293 294 306 329 330 334 335 342 350\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n6 9 11 21 28 39 42 56 60 63 81 88 91 95 105 110 117 125 149 165 174 176 185 189 193 196 205 231 233 268 278 279 281 286 289 292 298 303 305 306 334 342 350 353 361 371 372 375 376 378\\r\\n50\\r\\n6 17 20 43 45 52 58 59 82 83 88 102 111 118 121 131 145 173 190 191 200 216 224 225 232 235 243 256 260 271 290 291 321 322 323 329 331 333 334 341 343 348 351 354 356 360 366 379 387 388\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n17 239 443 467 661 1069 1823 2333 3767 4201\\r\\n20\\r\\n51 83 97 457 593 717 997 1329 1401 1459 1471 1983 2371 2539 3207 3251 3329 5469 6637 6999\\r\\n', 'output': ['8\\r\\n']}, {'input': '20\\r\\n179 359 401 467 521 601 919 941 1103 1279 1709 1913 1949 2003 2099 2143 2179 2213 2399 4673\\r\\n20\\r\\n151 181 191 251 421 967 1109 1181 1249 1447 1471 1553 1619 2327 2551 2791 3049 3727 6071 7813\\r\\n', 'output': ['3\\r\\n']}, {'input': '20\\r\\n79 113 151 709 809 983 1291 1399 1409 1429 2377 2659 2671 2897 3217 3511 3557 3797 3823 4363\\r\\n10\\r\\n19 101 659 797 1027 1963 2129 2971 3299 9217\\r\\n', 'output': ['3\\r\\n']}, {'input': '30\\r\\n19 47 109 179 307 331 389 401 461 509 547 569 617 853 883 1249 1361 1381 1511 1723 1741 1783 2459 2531 2621 3533 3821 4091 5557 6217\\r\\n20\\r\\n401 443 563 941 967 997 1535 1567 1655 1747 1787 1945 1999 2251 2305 2543 2735 4415 6245 7555\\r\\n', 'output': ['8\\r\\n']}, {'input': '30\\r\\n3 43 97 179 257 313 353 359 367 389 397 457 547 599 601 647 1013 1021 1063 1433 1481 1531 1669 3181 3373 3559 3769 4157 4549 5197\\r\\n50\\r\\n13 15 17 19 29 79 113 193 197 199 215 223 271 293 359 485 487 569 601 683 895 919 941 967 1283 1285 1289 1549 1565 1765 1795 1835 1907 1931 1945 1985 1993 2285 2731 2735 2995 3257 4049 4139 5105 5315 7165 7405 7655 8345\\r\\n', 'output': ['20\\r\\n']}, {'input': '50\\r\\n11 17 23 53 59 109 137 149 173 251 353 379 419 421 439 503 593 607 661 773 821 877 941 997 1061 1117 1153 1229 1289 1297 1321 1609 1747 2311 2389 2543 2693 3041 3083 3137 3181 3209 3331 3373 3617 3767 4201 4409 4931 6379\\r\\n50\\r\\n55 59 67 73 85 89 101 115 211 263 295 353 545 599 607 685 739 745 997 1031 1255 1493 1523 1667 1709 1895 1949 2161 2195 2965 3019 3035 3305 3361 3373 3673 3739 3865 3881 4231 4253 4385 4985 5305 5585 5765 6145 6445 8045 8735\\r\\n', 'output': ['23\\r\\n']}, {'input': '5\\r\\n33 78 146 3055 4268\\r\\n5\\r\\n2211 2584 5226 9402 9782\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n35 48 52 86 8001\\r\\n10\\r\\n332 3430 3554 4704 4860 5096 6215 7583 8228 8428\\r\\n', 'output': ['4\\r\\n']}, {'input': '10\\r\\n97 184 207 228 269 2084 4450 6396 7214 9457\\r\\n16\\r\\n338 1179 1284 1545 1570 2444 3167 3395 3397 5550 6440 7245 7804 7980 9415 9959\\r\\n', 'output': ['5\\r\\n']}, {'input': '30\\r\\n25 30 41 57 58 62 70 72 76 79 84 85 88 91 98 101 104 109 119 129 136 139 148 151 926 1372 3093 3936 5423 7350\\r\\n25\\r\\n1600 1920 2624 3648 3712 3968 4480 4608 4864 5056 5376 5440 5632 5824 6272 6464 6656 6934 6976 7616 8256 8704 8896 9472 9664\\r\\n', 'output': ['24\\r\\n']}, {'input': '5\\r\\n33 78 146 3055 4268\\r\\n5\\r\\n2211 2584 5226 9402 9782\\r\\n', 'output': ['3\\r\\n']}, {'input': '5\\r\\n35 48 52 86 8001\\r\\n10\\r\\n332 3430 3554 4704 4860 5096 6215 7583 8228 8428\\r\\n', 'output': ['4\\r\\n']}, {'input': '10\\r\\n97 184 207 228 269 2084 4450 6396 7214 9457\\r\\n16\\r\\n338 1179 1284 1545 1570 2444 3167 3395 3397 5550 6440 7245 7804 7980 9415 9959\\r\\n', 'output': ['5\\r\\n']}, {'input': '30\\r\\n25 30 41 57 58 62 70 72 76 79 84 85 88 91 98 101 104 109 119 129 136 139 148 151 926 1372 3093 3936 5423 7350\\r\\n25\\r\\n1600 1920 2624 3648 3712 3968 4480 4608 4864 5056 5376 5440 5632 5824 6272 6464 6656 6934 6976 7616 8256 8704 8896 9472 9664\\r\\n', 'output': ['24\\r\\n']}, {'input': '47\\r\\n66 262 357 457 513 530 538 540 592 691 707 979 1015 1242 1246 1667 1823 1886 1963 2133 2649 2679 2916 2949 3413 3523 3699 3958 4393 4922 5233 5306 5799 6036 6302 6629 7208 7282 7315 7822 7833 7927 8068 8150 8870 8962 9987\\r\\n39\\r\\n167 199 360 528 1515 1643 1986 1988 2154 2397 2856 3552 3656 3784 3980 4096 4104 4240 4320 4736 4951 5266 5656 5849 5850 6169 6517 6875 7244 7339 7689 7832 8120 8716 9503 9509 9933 9936 9968\\r\\n', 'output': ['12\\r\\n']}, {'input': '1\\r\\n94\\r\\n50\\r\\n423 446 485 1214 1468 1507 1853 1930 1999 2258 2271 2285 2425 2543 2715 2743 2992 3196 4074 4108 4448 4475 4652 5057 5250 5312 5356 5375 5731 5986 6298 6501 6521 7146 7255 7276 7332 7481 7998 8141 8413 8665 8908 9221 9336 9491 9504 9677 9693 9706\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n51 67 75 186 194 355 512 561 720 876 1077 1221 1503 1820 2153 2385 2568 2608 2937 2969 3271 3311 3481 4081 4093 4171 4255 4256 4829 5020 5192 5636 5817 6156 6712 6717 7153 7436 7608 7612 7866 7988 8264 8293 8867 9311 9879 9882 9889 9908\\r\\n1\\r\\n5394\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n26 367 495 585 675 789 855 1185 1312 1606 2037 2241 2587 2612 2628 2807 2873 2924 3774 4067 4376 4668 4902 5001 5082 5100 5104 5209 5345 5515 5661 5777 5902 5907 6155 6323 6675 6791 7503 8159 8207 8254 8740 8848 8855 8933 9069 9164 9171 9586\\r\\n5\\r\\n1557 6246 7545 8074 8284\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n25 58 91 110 2658\\r\\n50\\r\\n21 372 909 1172 1517 1554 1797 1802 1843 1977 2006 2025 2137 2225 2317 2507 2645 2754 2919 3024 3202 3212 3267 3852 4374 4487 4553 4668 4883 4911 4916 5016 5021 5068 5104 5162 5683 5856 6374 6871 7333 7531 8099 8135 8173 8215 8462 8776 9433 9790\\r\\n', 'output': ['4\\r\\n']}, {'input': '45\\r\\n37 48 56 59 69 70 79 83 85 86 99 114 131 134 135 145 156 250 1739 1947 2116 2315 2449 3104 3666 4008 4406 4723 4829 5345 5836 6262 6296 6870 7065 7110 7130 7510 7595 8092 8442 8574 9032 9091 9355\\r\\n50\\r\\n343 846 893 1110 1651 1837 2162 2331 2596 3012 3024 3131 3294 3394 3528 3717 3997 4125 4347 4410 4581 4977 5030 5070 5119 5229 5355 5413 5418 5474 5763 5940 6151 6161 6164 6237 6506 6519 6783 7182 7413 7534 8069 8253 8442 8505 9135 9308 9828 9902\\r\\n', 'output': ['17\\r\\n']}, {'input': '50\\r\\n17 20 22 28 36 38 46 47 48 50 52 57 58 62 63 69 70 74 75 78 79 81 82 86 87 90 93 95 103 202 292 442 1756 1769 2208 2311 2799 2957 3483 4280 4324 4932 5109 5204 6225 6354 6561 7136 8754 9670\\r\\n40\\r\\n68 214 957 1649 1940 2078 2134 2716 3492 3686 4462 4559 4656 4756 4850 5044 5490 5529 5592 5626 6014 6111 6693 6790 7178 7275 7566 7663 7702 7857 7954 8342 8511 8730 8957 9021 9215 9377 9445 9991\\r\\n', 'output': ['28\\r\\n']}, {'input': '39\\r\\n10 13 21 25 36 38 47 48 58 64 68 69 73 79 86 972 2012 2215 2267 2503 3717 3945 4197 4800 5266 6169 6612 6824 7023 7322 7582 7766 8381 8626 8879 9079 9088 9838 9968\\r\\n50\\r\\n432 877 970 1152 1202 1223 1261 1435 1454 1578 1843 1907 2003 2037 2183 2195 2215 2425 3065 3492 3615 3637 3686 3946 4189 4415 4559 4656 4665 4707 4886 4887 5626 5703 5955 6208 6521 6581 6596 6693 6985 7013 7081 7343 7663 8332 8342 8637 9207 9862\\r\\n', 'output': ['15\\r\\n']}, {'input': '50\\r\\n7 144 269 339 395 505 625 688 709 950 1102 1152 1350 1381 1641 1830 1977 1999 2093 2180 2718 3308 3574 4168 4232 4259 4393 4689 4982 5154 5476 5581 5635 5721 6159 6302 6741 7010 7152 7315 7417 7482 8116 8239 8640 9347 9395 9614 9661 9822\\r\\n20\\r\\n84 162 292 1728 1866 2088 3228 3470 4068 5318 5470 6060 6380 6929 7500 8256 8399 8467 8508 9691\\r\\n', 'output': ['8\\r\\n']}, {'input': '50\\r\\n159 880 1070 1139 1358 1608 1691 1841 2073 2171 2213 2597 2692 2759 2879 2931 3173 3217 3441 4201 4878 5106 5129 5253 5395 5647 5968 6019 6130 6276 6286 6330 6409 6728 7488 7713 7765 7828 7899 8064 8264 8457 8483 8685 8900 8946 8965 9133 9187 9638\\r\\n45\\r\\n57 159 1070 1139 1391 1608 1691 1841 2171 2213 2692 2759 2931 3173 3217 3441 4201 4878 5106 5129 5253 5647 5968 6130 6276 6286 6409 7488 7694 7713 7765 7828 7899 8003 8064 8081 8244 8264 8685 8900 8946 8965 9133 9638 9673\\r\\n', 'output': ['38\\r\\n']}, {'input': '3\\r\\n3 4 5\\r\\n3\\r\\n6 20 25\\r\\n', 'output': ['2\\r\\n']}, {'input': '4\\r\\n2 3 5 8\\r\\n4\\r\\n2 6 8 10\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n3 5 7 11\\r\\n4\\r\\n3 5 7 22\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n3\\r\\n20 30 50\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n1 2 3\\r\\n4\\r\\n2 4 6 49\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n4 5\\r\\n3\\r\\n12 15 20\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n2 5 7\\r\\n3\\r\\n4 5 7\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n3 5 8\\r\\n3\\r\\n6 8 10\\r\\n', 'output': ['2\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n4\\r\\n4 6 9 33\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n4\\r\\n4 6 21 40\\r\\n', 'output': ['1\\r\\n']}, {'input': '3\\r\\n4 9 10\\r\\n3\\r\\n8 9 10\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 5 6 9 51\\r\\n5\\r\\n5 12 18 27 10000\\r\\n', 'output': ['1\\r\\n']}, {'input': '13\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13\\r\\n1\\r\\n14\\r\\n', 'output': ['1\\r\\n']}]","id":137} {"description":"Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it's impossible to get from some snow drifts to some other by any sequence of moves. He now wants to heap up some additional snow drifts, so that he can get from any snow drift to any other one. He asked you to find the minimal number of snow drifts that need to be created.We assume that Bajtek can only heap up snow drifts at integer coordinates.","input_specification":"The first line of input contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 the number of snow drifts. Each of the following n lines contains two integers xi and yi (1\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u20091000) \u2014 the coordinates of the i-th snow drift. Note that the north direction coin\u0441ides with the direction of Oy axis, so the east direction coin\u0441ides with the direction of the Ox axis. All snow drift's locations are distinct.","output_specification":"Output the minimal number of snow drifts that need to be created in order for Bajtek to be able to reach any snow drift from any other one.","notes":null,"sample_inputs":["2\n2 1\n1 2","2\n2 1\n4 1"],"sample_outputs":["1","0"],"src_uid":"cb4dbff31d967c3dab8fe0495eb871dc","lang_cluster":"Python","difficulty":1200,"human_solution":"n = int(input())\n\ncoodenadas = []\nfor i in range(n):\n x, y = [ int(i) for i in input().split() ]\n coodenadas.append({\n 'x': { x },\n 'y': { y }\n })\n\nfor i in range(n-1, -1, -1):\n j = i - 1\n while j >= 0 and i < len(coodenadas):\n if len(coodenadas[j]['x'].intersection(coodenadas[i]['x'])) or len(coodenadas[j]['y'].intersection(coodenadas[i]['y'])):\n coodenadas[i]['x'].update(coodenadas[j]['x'])\n coodenadas[i]['y'].update(coodenadas[j]['y'])\n coodenadas.pop(j)\n j -= 1\n\nprint(len(coodenadas) - 1)","testcases":"[{'input': '2\\r\\n2 1\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n2 1\\r\\n4 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '24\\r\\n171 35\\r\\n261 20\\r\\n4 206\\r\\n501 446\\r\\n961 912\\r\\n581 748\\r\\n946 978\\r\\n463 514\\r\\n841 889\\r\\n341 466\\r\\n842 967\\r\\n54 102\\r\\n235 261\\r\\n925 889\\r\\n682 672\\r\\n623 636\\r\\n268 94\\r\\n635 710\\r\\n474 510\\r\\n697 794\\r\\n586 663\\r\\n182 184\\r\\n806 663\\r\\n468 459\\r\\n', 'output': ['21\\r\\n']}, {'input': '17\\r\\n660 646\\r\\n440 442\\r\\n689 618\\r\\n441 415\\r\\n922 865\\r\\n950 972\\r\\n312 366\\r\\n203 229\\r\\n873 860\\r\\n219 199\\r\\n344 308\\r\\n169 176\\r\\n961 992\\r\\n153 84\\r\\n201 230\\r\\n987 938\\r\\n834 815\\r\\n', 'output': ['16\\r\\n']}, {'input': '11\\r\\n798 845\\r\\n722 911\\r\\n374 270\\r\\n629 537\\r\\n748 856\\r\\n831 885\\r\\n486 641\\r\\n751 829\\r\\n609 492\\r\\n98 27\\r\\n654 663\\r\\n', 'output': ['10\\r\\n']}, {'input': '1\\r\\n321 88\\r\\n', 'output': ['0\\r\\n']}, {'input': '9\\r\\n811 859\\r\\n656 676\\r\\n76 141\\r\\n945 951\\r\\n497 455\\r\\n18 55\\r\\n335 294\\r\\n267 275\\r\\n656 689\\r\\n', 'output': ['7\\r\\n']}, {'input': '7\\r\\n948 946\\r\\n130 130\\r\\n761 758\\r\\n941 938\\r\\n971 971\\r\\n387 385\\r\\n509 510\\r\\n', 'output': ['6\\r\\n']}, {'input': '6\\r\\n535 699\\r\\n217 337\\r\\n508 780\\r\\n180 292\\r\\n393 112\\r\\n732 888\\r\\n', 'output': ['5\\r\\n']}, {'input': '14\\r\\n25 23\\r\\n499 406\\r\\n193 266\\r\\n823 751\\r\\n219 227\\r\\n101 138\\r\\n978 992\\r\\n43 74\\r\\n997 932\\r\\n237 189\\r\\n634 538\\r\\n774 740\\r\\n842 767\\r\\n742 802\\r\\n', 'output': ['13\\r\\n']}, {'input': '12\\r\\n548 506\\r\\n151 198\\r\\n370 380\\r\\n655 694\\r\\n654 690\\r\\n407 370\\r\\n518 497\\r\\n819 827\\r\\n765 751\\r\\n802 771\\r\\n741 752\\r\\n653 662\\r\\n', 'output': ['11\\r\\n']}, {'input': '40\\r\\n685 711\\r\\n433 403\\r\\n703 710\\r\\n491 485\\r\\n616 619\\r\\n288 282\\r\\n884 871\\r\\n367 352\\r\\n500 511\\r\\n977 982\\r\\n51 31\\r\\n576 564\\r\\n508 519\\r\\n755 762\\r\\n22 20\\r\\n368 353\\r\\n232 225\\r\\n953 955\\r\\n452 436\\r\\n311 330\\r\\n967 988\\r\\n369 364\\r\\n791 803\\r\\n150 149\\r\\n651 661\\r\\n118 93\\r\\n398 387\\r\\n748 766\\r\\n852 852\\r\\n230 228\\r\\n555 545\\r\\n515 519\\r\\n667 678\\r\\n867 862\\r\\n134 146\\r\\n859 863\\r\\n96 99\\r\\n486 469\\r\\n303 296\\r\\n780 786\\r\\n', 'output': ['38\\r\\n']}, {'input': '3\\r\\n175 201\\r\\n907 909\\r\\n388 360\\r\\n', 'output': ['2\\r\\n']}, {'input': '7\\r\\n312 298\\r\\n86 78\\r\\n73 97\\r\\n619 594\\r\\n403 451\\r\\n538 528\\r\\n71 86\\r\\n', 'output': ['6\\r\\n']}, {'input': '19\\r\\n802 820\\r\\n368 248\\r\\n758 794\\r\\n455 378\\r\\n876 888\\r\\n771 814\\r\\n245 177\\r\\n586 555\\r\\n844 842\\r\\n364 360\\r\\n820 856\\r\\n731 624\\r\\n982 975\\r\\n825 856\\r\\n122 121\\r\\n862 896\\r\\n42 4\\r\\n792 841\\r\\n828 820\\r\\n', 'output': ['16\\r\\n']}, {'input': '32\\r\\n643 877\\r\\n842 614\\r\\n387 176\\r\\n99 338\\r\\n894 798\\r\\n652 728\\r\\n611 648\\r\\n622 694\\r\\n579 781\\r\\n243 46\\r\\n322 305\\r\\n198 438\\r\\n708 579\\r\\n246 325\\r\\n536 459\\r\\n874 593\\r\\n120 277\\r\\n989 907\\r\\n223 110\\r\\n35 130\\r\\n761 692\\r\\n690 661\\r\\n518 766\\r\\n226 93\\r\\n678 597\\r\\n725 617\\r\\n661 574\\r\\n775 496\\r\\n56 416\\r\\n14 189\\r\\n358 359\\r\\n898 901\\r\\n', 'output': ['31\\r\\n']}, {'input': '32\\r\\n325 327\\r\\n20 22\\r\\n72 74\\r\\n935 933\\r\\n664 663\\r\\n726 729\\r\\n785 784\\r\\n170 171\\r\\n315 314\\r\\n577 580\\r\\n984 987\\r\\n313 317\\r\\n434 435\\r\\n962 961\\r\\n55 54\\r\\n46 44\\r\\n743 742\\r\\n434 433\\r\\n617 612\\r\\n332 332\\r\\n883 886\\r\\n940 936\\r\\n793 792\\r\\n645 644\\r\\n611 607\\r\\n418 418\\r\\n465 465\\r\\n219 218\\r\\n167 164\\r\\n56 54\\r\\n403 405\\r\\n210 210\\r\\n', 'output': ['29\\r\\n']}, {'input': '32\\r\\n652 712\\r\\n260 241\\r\\n27 154\\r\\n188 16\\r\\n521 351\\r\\n518 356\\r\\n452 540\\r\\n790 827\\r\\n339 396\\r\\n336 551\\r\\n897 930\\r\\n828 627\\r\\n27 168\\r\\n180 113\\r\\n134 67\\r\\n794 671\\r\\n812 711\\r\\n100 241\\r\\n686 813\\r\\n138 289\\r\\n384 506\\r\\n884 932\\r\\n913 959\\r\\n470 508\\r\\n730 734\\r\\n373 478\\r\\n788 862\\r\\n392 426\\r\\n148 68\\r\\n113 49\\r\\n713 852\\r\\n924 894\\r\\n', 'output': ['29\\r\\n']}, {'input': '14\\r\\n685 808\\r\\n542 677\\r\\n712 747\\r\\n832 852\\r\\n187 410\\r\\n399 338\\r\\n626 556\\r\\n530 635\\r\\n267 145\\r\\n215 209\\r\\n559 684\\r\\n944 949\\r\\n753 596\\r\\n601 823\\r\\n', 'output': ['13\\r\\n']}, {'input': '5\\r\\n175 158\\r\\n16 2\\r\\n397 381\\r\\n668 686\\r\\n957 945\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n312 284\\r\\n490 509\\r\\n730 747\\r\\n504 497\\r\\n782 793\\r\\n', 'output': ['4\\r\\n']}, {'input': '2\\r\\n802 903\\r\\n476 348\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n325 343\\r\\n425 442\\r\\n785 798\\r\\n275 270\\r\\n', 'output': ['3\\r\\n']}, {'input': '28\\r\\n462 483\\r\\n411 401\\r\\n118 94\\r\\n111 127\\r\\n5 6\\r\\n70 52\\r\\n893 910\\r\\n73 63\\r\\n818 818\\r\\n182 201\\r\\n642 633\\r\\n900 886\\r\\n893 886\\r\\n684 700\\r\\n157 173\\r\\n953 953\\r\\n671 660\\r\\n224 225\\r\\n832 801\\r\\n152 157\\r\\n601 585\\r\\n115 101\\r\\n739 722\\r\\n611 606\\r\\n659 642\\r\\n461 469\\r\\n702 689\\r\\n649 653\\r\\n', 'output': ['25\\r\\n']}, {'input': '36\\r\\n952 981\\r\\n885 900\\r\\n803 790\\r\\n107 129\\r\\n670 654\\r\\n143 132\\r\\n66 58\\r\\n813 819\\r\\n849 837\\r\\n165 198\\r\\n247 228\\r\\n15 39\\r\\n619 618\\r\\n105 138\\r\\n868 855\\r\\n965 957\\r\\n293 298\\r\\n613 599\\r\\n227 212\\r\\n745 754\\r\\n723 704\\r\\n877 858\\r\\n503 487\\r\\n678 697\\r\\n592 595\\r\\n155 135\\r\\n962 982\\r\\n93 89\\r\\n660 673\\r\\n225 212\\r\\n967 987\\r\\n690 680\\r\\n804 813\\r\\n489 518\\r\\n240 221\\r\\n111 124\\r\\n', 'output': ['34\\r\\n']}, {'input': '30\\r\\n89 3\\r\\n167 156\\r\\n784 849\\r\\n943 937\\r\\n144 95\\r\\n24 159\\r\\n80 120\\r\\n657 683\\r\\n585 596\\r\\n43 147\\r\\n909 964\\r\\n131 84\\r\\n345 389\\r\\n333 321\\r\\n91 126\\r\\n274 325\\r\\n859 723\\r\\n866 922\\r\\n622 595\\r\\n690 752\\r\\n902 944\\r\\n127 170\\r\\n426 383\\r\\n905 925\\r\\n172 284\\r\\n793 810\\r\\n414 510\\r\\n890 884\\r\\n123 24\\r\\n267 255\\r\\n', 'output': ['29\\r\\n']}, {'input': '5\\r\\n664 666\\r\\n951 941\\r\\n739 742\\r\\n844 842\\r\\n2 2\\r\\n', 'output': ['4\\r\\n']}, {'input': '3\\r\\n939 867\\r\\n411 427\\r\\n757 708\\r\\n', 'output': ['2\\r\\n']}, {'input': '36\\r\\n429 424\\r\\n885 972\\r\\n442 386\\r\\n512 511\\r\\n751 759\\r\\n4 115\\r\\n461 497\\r\\n496 408\\r\\n8 23\\r\\n542 562\\r\\n296 331\\r\\n448 492\\r\\n412 395\\r\\n109 166\\r\\n622 640\\r\\n379 355\\r\\n251 262\\r\\n564 586\\r\\n66 115\\r\\n275 291\\r\\n666 611\\r\\n629 534\\r\\n510 567\\r\\n635 666\\r\\n738 803\\r\\n420 369\\r\\n92 17\\r\\n101 144\\r\\n141 92\\r\\n258 258\\r\\n184 235\\r\\n492 456\\r\\n311 210\\r\\n394 357\\r\\n531 512\\r\\n634 636\\r\\n', 'output': ['34\\r\\n']}, {'input': '29\\r\\n462 519\\r\\n871 825\\r\\n127 335\\r\\n156 93\\r\\n576 612\\r\\n885 830\\r\\n634 779\\r\\n340 105\\r\\n744 795\\r\\n716 474\\r\\n93 139\\r\\n563 805\\r\\n137 276\\r\\n177 101\\r\\n333 14\\r\\n391 437\\r\\n873 588\\r\\n817 518\\r\\n460 597\\r\\n572 670\\r\\n140 303\\r\\n392 441\\r\\n273 120\\r\\n862 578\\r\\n670 639\\r\\n410 161\\r\\n544 577\\r\\n193 116\\r\\n252 195\\r\\n', 'output': ['28\\r\\n']}, {'input': '23\\r\\n952 907\\r\\n345 356\\r\\n812 807\\r\\n344 328\\r\\n242 268\\r\\n254 280\\r\\n1000 990\\r\\n80 78\\r\\n424 396\\r\\n595 608\\r\\n755 813\\r\\n383 380\\r\\n55 56\\r\\n598 633\\r\\n203 211\\r\\n508 476\\r\\n600 593\\r\\n206 192\\r\\n855 882\\r\\n517 462\\r\\n967 994\\r\\n642 657\\r\\n493 488\\r\\n', 'output': ['22\\r\\n']}, {'input': '10\\r\\n579 816\\r\\n806 590\\r\\n830 787\\r\\n120 278\\r\\n677 800\\r\\n16 67\\r\\n188 251\\r\\n559 560\\r\\n87 67\\r\\n104 235\\r\\n', 'output': ['8\\r\\n']}, {'input': '23\\r\\n420 424\\r\\n280 303\\r\\n515 511\\r\\n956 948\\r\\n799 803\\r\\n441 455\\r\\n362 369\\r\\n299 289\\r\\n823 813\\r\\n982 967\\r\\n876 878\\r\\n185 157\\r\\n529 551\\r\\n964 989\\r\\n655 656\\r\\n1 21\\r\\n114 112\\r\\n45 56\\r\\n935 937\\r\\n1000 997\\r\\n934 942\\r\\n360 366\\r\\n648 621\\r\\n', 'output': ['22\\r\\n']}, {'input': '23\\r\\n102 84\\r\\n562 608\\r\\n200 127\\r\\n952 999\\r\\n465 496\\r\\n322 367\\r\\n728 690\\r\\n143 147\\r\\n855 867\\r\\n861 866\\r\\n26 59\\r\\n300 273\\r\\n255 351\\r\\n192 246\\r\\n70 111\\r\\n365 277\\r\\n32 104\\r\\n298 319\\r\\n330 354\\r\\n241 141\\r\\n56 125\\r\\n315 298\\r\\n412 461\\r\\n', 'output': ['22\\r\\n']}, {'input': '7\\r\\n429 506\\r\\n346 307\\r\\n99 171\\r\\n853 916\\r\\n322 263\\r\\n115 157\\r\\n906 924\\r\\n', 'output': ['6\\r\\n']}, {'input': '3\\r\\n1 1\\r\\n2 1\\r\\n2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n3 1\\r\\n3 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n3 1\\r\\n3 2\\r\\n3 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '20\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n3 9\\r\\n4 4\\r\\n5 2\\r\\n5 5\\r\\n5 7\\r\\n5 8\\r\\n6 2\\r\\n6 6\\r\\n6 9\\r\\n7 7\\r\\n8 8\\r\\n9 4\\r\\n9 7\\r\\n9 9\\r\\n10 2\\r\\n10 9\\r\\n10 10\\r\\n', 'output': ['1\\r\\n']}, {'input': '21\\r\\n1 1\\r\\n1 9\\r\\n2 1\\r\\n2 2\\r\\n2 5\\r\\n2 6\\r\\n2 9\\r\\n3 3\\r\\n3 8\\r\\n4 1\\r\\n4 4\\r\\n5 5\\r\\n5 8\\r\\n6 6\\r\\n7 7\\r\\n8 8\\r\\n9 9\\r\\n10 4\\r\\n10 10\\r\\n11 5\\r\\n11 11\\r\\n', 'output': ['1\\r\\n']}, {'input': '22\\r\\n1 1\\r\\n1 3\\r\\n1 4\\r\\n1 8\\r\\n1 9\\r\\n1 11\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n4 5\\r\\n5 5\\r\\n6 6\\r\\n6 8\\r\\n7 7\\r\\n8 3\\r\\n8 4\\r\\n8 8\\r\\n9 9\\r\\n10 10\\r\\n11 4\\r\\n11 9\\r\\n11 11\\r\\n', 'output': ['3\\r\\n']}, {'input': '50\\r\\n1 1\\r\\n2 2\\r\\n2 9\\r\\n3 3\\r\\n4 4\\r\\n4 9\\r\\n4 16\\r\\n4 24\\r\\n5 5\\r\\n6 6\\r\\n7 7\\r\\n8 8\\r\\n8 9\\r\\n8 20\\r\\n9 9\\r\\n10 10\\r\\n11 11\\r\\n12 12\\r\\n13 13\\r\\n14 7\\r\\n14 14\\r\\n14 16\\r\\n14 25\\r\\n15 4\\r\\n15 6\\r\\n15 15\\r\\n15 22\\r\\n16 6\\r\\n16 16\\r\\n17 17\\r\\n18 18\\r\\n19 6\\r\\n19 19\\r\\n20 20\\r\\n21 21\\r\\n22 6\\r\\n22 22\\r\\n23 23\\r\\n24 6\\r\\n24 7\\r\\n24 8\\r\\n24 9\\r\\n24 24\\r\\n25 1\\r\\n25 3\\r\\n25 5\\r\\n25 7\\r\\n25 23\\r\\n25 24\\r\\n25 25\\r\\n', 'output': ['7\\r\\n']}, {'input': '55\\r\\n1 1\\r\\n1 14\\r\\n2 2\\r\\n2 19\\r\\n3 1\\r\\n3 3\\r\\n3 8\\r\\n3 14\\r\\n3 23\\r\\n4 1\\r\\n4 4\\r\\n5 5\\r\\n5 8\\r\\n5 15\\r\\n6 2\\r\\n6 3\\r\\n6 4\\r\\n6 6\\r\\n7 7\\r\\n8 8\\r\\n8 21\\r\\n9 9\\r\\n10 1\\r\\n10 10\\r\\n11 9\\r\\n11 11\\r\\n12 12\\r\\n13 13\\r\\n14 14\\r\\n15 15\\r\\n15 24\\r\\n16 5\\r\\n16 16\\r\\n17 5\\r\\n17 10\\r\\n17 17\\r\\n17 18\\r\\n17 22\\r\\n17 27\\r\\n18 18\\r\\n19 19\\r\\n20 20\\r\\n21 20\\r\\n21 21\\r\\n22 22\\r\\n23 23\\r\\n24 14\\r\\n24 24\\r\\n25 25\\r\\n26 8\\r\\n26 11\\r\\n26 26\\r\\n27 3\\r\\n27 27\\r\\n28 28\\r\\n', 'output': ['5\\r\\n']}, {'input': '3\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n4 4\\r\\n3 4\\r\\n5 4\\r\\n4 5\\r\\n4 3\\r\\n3 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1\\r\\n1 2\\r\\n2 1\\r\\n2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '8\\r\\n1 3\\r\\n1 1\\r\\n4 1\\r\\n2 2\\r\\n2 5\\r\\n5 9\\r\\n5 1\\r\\n5 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n1 1\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n5 5\\r\\n6 6\\r\\n7 7\\r\\n8 8\\r\\n9 9\\r\\n100 100\\r\\n', 'output': ['6\\r\\n']}, {'input': '7\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n1 1\\r\\n2 1\\r\\n2 2\\r\\n2 4\\r\\n4 3\\r\\n2 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n3 1\\r\\n2 1\\r\\n2 2\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n1 1\\r\\n2 2\\r\\n2 1\\r\\n2 4\\r\\n4 3\\r\\n2 3\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 2\\r\\n1 3\\r\\n1 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 1\\r\\n2 2\\r\\n1 2\\r\\n2 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n1 3\\r\\n2 1\\r\\n3 2\\r\\n3 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '7\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n3 3\\r\\n3 4\\r\\n4 4\\r\\n1 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '21\\r\\n12 12\\r\\n13 12\\r\\n12 11\\r\\n13 13\\r\\n10 10\\r\\n11 10\\r\\n11 11\\r\\n501 500\\r\\n501 501\\r\\n503 502\\r\\n500 500\\r\\n503 503\\r\\n502 501\\r\\n502 502\\r\\n700 700\\r\\n702 702\\r\\n703 702\\r\\n701 701\\r\\n702 701\\r\\n703 703\\r\\n701 700\\r\\n', 'output': ['2\\r\\n']}, {'input': '6\\r\\n1 11\\r\\n6 8\\r\\n11 10\\r\\n1 10\\r\\n11 11\\r\\n6 9\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n1 1\\r\\n2 2\\r\\n3 2\\r\\n3 1\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 2\\r\\n3 4\\r\\n3 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '4\\r\\n5 5\\r\\n5 4\\r\\n6 3\\r\\n6 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n1 1\\r\\n2 2\\r\\n2 1\\r\\n', 'output': ['0\\r\\n']}]","id":138} {"description":"Peter likes to travel by train. He likes it so much that on the train he falls asleep. Once in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started to look through the window and noticed that every railway station has a flag of a particular colour.The boy started to memorize the order of the flags' colours that he had seen. But soon he fell asleep again. Unfortunately, he didn't sleep long, he woke up and went on memorizing the colours. Then he fell asleep again, and that time he slept till the end of the journey.At the station he told his parents about what he was doing, and wrote two sequences of the colours that he had seen before and after his sleep, respectively.Peter's parents know that their son likes to fantasize. They give you the list of the flags' colours at the stations that the train passes sequentially on the way from A to B, and ask you to find out if Peter could see those sequences on the way from A to B, or from B to A. Remember, please, that Peter had two periods of wakefulness.Peter's parents put lowercase Latin letters for colours. The same letter stands for the same colour, different letters \u2014 for different colours.","input_specification":"The input data contains three lines. The first line contains a non-empty string, whose length does not exceed 105, the string consists of lowercase Latin letters \u2014 the flags' colours at the stations on the way from A to B. On the way from B to A the train passes the same stations, but in reverse order. The second line contains the sequence, written by Peter during the first period of wakefulness. The third line contains the sequence, written during the second period of wakefulness. Both sequences are non-empty, consist of lowercase Latin letters, and the length of each does not exceed 100 letters. Each of the sequences is written in chronological order. ","output_specification":"Output one of the four words without inverted commas: \u00abforward\u00bb \u2014 if Peter could see such sequences only on the way from A to B; \u00abbackward\u00bb \u2014 if Peter could see such sequences on the way from B to A; \u00abboth\u00bb \u2014 if Peter could see such sequences both on the way from A to B, and on the way from B to A; \u00abfantasy\u00bb \u2014 if Peter could not see such sequences. ","notes":"NoteIt is assumed that the train moves all the time, so one flag cannot be seen twice. There are no flags at stations A and B.","sample_inputs":["atob\na\nb","aaacaaa\naca\naa"],"sample_outputs":["forward","both"],"src_uid":"c3244e952830643938d51ce14f043d7d","lang_cluster":"Python","difficulty":1200,"human_solution":"\"\"\"\nPeter likes to travel by train. He likes it so much that on the train he falls asleep.\n\nOnce in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started to look through the window and noticed that every railway station has a flag of a particular colour.\n\nThe boy started to memorize the order of the flags' colours that he had seen. But soon he fell asleep again. Unfortunately, he didn't sleep long, he woke up and went on memorizing the colours. Then he fell asleep again, and that time he slept till the end of the journey.\n\nAt the station he told his parents about what he was doing, and wrote two sequences of the colours that he had seen before and after his sleep, respectively.\n\nPeter's parents know that their son likes to fantasize. They give you the list of the flags' colours at the stations that the train passes sequentially on the way from A to B, and ask you to find out if Peter could see those sequences on the way from A to B, or from B to A. Remember, please, that Peter had two periods of wakefulness.\n\nPeter's parents put lowercase Latin letters for colours. The same letter stands for the same colour, different letters \u2014 for different colours.\n\nInput\nThe input data contains three lines. The first line contains a non-empty string, whose length does not exceed 105, the string consists of lowercase Latin letters \u2014 the flags' colours at the stations on the way from A to B. On the way from B to A the train passes the same stations, but in reverse order.\n\nThe second line contains the sequence, written by Peter during the first period of wakefulness. The third line contains the sequence, written during the second period of wakefulness. Both sequences are non-empty, consist of lowercase Latin letters, and the length of each does not exceed 100 letters. Each of the sequences is written in chronological order.\n\nOutput\nOutput one of the four words without inverted commas:\n\n\u00abforward\u00bb \u2014 if Peter could see such sequences only on the way from A to B;\n\u00abbackward\u00bb \u2014 if Peter could see such sequences on the way from B to A;\n\u00abboth\u00bb \u2014 if Peter could see such sequences both on the way from A to B, and on the way from B to A;\n\u00abfantasy\u00bb \u2014 if Peter could not see such sequences.\n\"\"\"\n\n\nx = input()\nx_reversed = ''.join(list(reversed(x)))\n\n# print(x)\n# print(x_reversed)\n\nseq1 = input()\nseq2 = input()\n\nif len(seq1) + len(seq2) > len(x):\n\tprint('fantasy')\nelse:\n\tforward = False\n\tbackward = False\n\n\tx_find_seq1 = x.find(seq1)\n\tif x_find_seq1 > -1:\n\t\tx_find_seq2 = x[x_find_seq1 + len(seq1):].find(seq2)\n\t\tif x_find_seq2 > -1:\n\t\t\tx_find_seq2 += x_find_seq1 + len(seq1)\n\telse:\n\t\tx_find_seq2 = -1\n\n\tx_reversed_find_seq1 = x_reversed.find(seq1)\n\tif x_reversed_find_seq1 > -1:\n\t\tx_reversed_find_seq2 = x_reversed[x_reversed_find_seq1 + len(seq1):].find(seq2)\n\t\tif x_reversed_find_seq2 > -1:\n\t\t\tx_reversed_find_seq2 += x_reversed_find_seq1 + len(seq1)\n\telse:\n\t\tx_reversed_find_seq2 = -1\n\n\t# print('x_find_seq1:', x_find_seq1)\n\t# print('x_find_seq2:', x_find_seq2)\n\n\t# print(\"--------\")\n\t# print(x_reversed)\n\t# print('x_reversed_find_seq1:', x_reversed_find_seq1)\n\t# print('x_reversed_find_seq2:', x_reversed_find_seq2)\n\n\tif (x_find_seq1 != -1 and x_find_seq1 != -1):\n\t\tif x_find_seq1 <= x_find_seq2:\n\t\t\tforward = True\n\n\tif (x_reversed_find_seq1 != -1 and x_reversed_find_seq1 != -1):\n\t\tif x_reversed_find_seq1 <= x_reversed_find_seq2:\n\t\t\tbackward = True\n\n\tif forward and backward:\n\t\tprint('both')\n\telif forward:\n\t\tprint(\"forward\")\n\telif backward:\n\t\tprint(\"backward\")\n\telse:\n\t\tprint('fantasy')\n\n\"\"\"\nx = [1,2,3,4]\nprint(x[1:])\n\n\nseq1_list = list(seq1)\nseq1_len = len(seq1)\n\nseq2_list = list(seq2)\nseq2_len = len(seq2)\n\nx_len = len(x)\n\nseq1_found = False\nfor elm, i in enumerate(x):\n\tif elm == seq1_list[0] and x_len-i >= seq1_len:\n\t\tfor j in seq2_list:\n\t\t\tif j != \n\"\"\"","testcases":"[{'input': 'atob\\r\\na\\r\\nb\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'aaacaaa\\r\\naca\\r\\naa\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aaa\\r\\naa\\r\\naa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'astalavista\\r\\nastla\\r\\nlavista\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'abacabadabacaba\\r\\nabacaba\\r\\nabacaba\\r\\n', 'output': ['both\\r\\n']}, {'input': 'a\\r\\na\\r\\na\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'ab\\r\\nb\\r\\na\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'aaa\\r\\naaaa\\r\\naaaa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'bbabbbbababbaabaabaa\\r\\nabb\\r\\nbaab\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'bbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbb\\r\\nbbbbb\\r\\n', 'output': ['both\\r\\n']}, {'input': 'babaabababaaaababaabababaabababababababbababbbabbaabababaababbaabbababaababaaabababaabbaababaaababaa\\r\\nabaabababaa\\r\\nabaabbaa\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'bbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbb\\r\\nbbbbb\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aababaaababaabbaabababaaababaabababbaabbabaabababaabbabbbababbababababababaabababaababaaaabababaabab\\r\\nabaabababaa\\r\\nabaabbaa\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'aaaa\\r\\naaa\\r\\naa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzz\\r\\nzzz\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzzzz\\r\\nzzzz\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzz\\r\\nzz\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aabaa\\r\\naab\\r\\nbaa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'aabaab\\r\\naba\\r\\nab\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'aab\\r\\nb\\r\\naa\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'abacaba\\r\\naca\\r\\nba\\r\\n', 'output': ['both\\r\\n']}]","id":139} {"description":"And again a misfortune fell on Poor Student. He is being late for an exam.Having rushed to a bus stop that is in point (0,\u20090), he got on a minibus and they drove along a straight line, parallel to axis OX, in the direction of increasing x.Poor Student knows the following: during one run the minibus makes n stops, the i-th stop is in point (xi,\u20090) coordinates of all the stops are different the minibus drives at a constant speed, equal to vb it can be assumed the passengers get on and off the minibus at a bus stop momentarily Student can get off the minibus only at a bus stop Student will have to get off the minibus at a terminal stop, if he does not get off earlier the University, where the exam will be held, is in point (xu,\u2009yu) Student can run from a bus stop to the University at a constant speed vs as long as needed a distance between two points can be calculated according to the following formula: Student is already on the minibus, so, he cannot get off at the first bus stop Poor Student wants to get to the University as soon as possible. Help him to choose the bus stop, where he should get off. If such bus stops are multiple, choose the bus stop closest to the University.","input_specification":"The first line contains three integer numbers: 2\u2009\u2264\u2009n\u2009\u2264\u2009100, 1\u2009\u2264\u2009vb,\u2009vs\u2009\u2264\u20091000. The second line contains n non-negative integers in ascending order: coordinates xi of the bus stop with index i. It is guaranteed that x1 equals to zero, and xn\u2009\u2264\u2009105. The third line contains the coordinates of the University, integers xu and yu, not exceeding 105 in absolute value. ","output_specification":"In the only line output the answer to the problem \u2014 index of the optimum bus stop.","notes":"NoteAs you know, students are a special sort of people, and minibuses usually do not hurry. That's why you should not be surprised, if Student's speed is higher than the speed of the minibus.","sample_inputs":["4 5 2\n0 2 4 6\n4 1","2 1 1\n0 100000\n100000 100000"],"sample_outputs":["3","2"],"src_uid":"15fa49860e978d3b3fb7a20bf9f8aa86","lang_cluster":"Python","difficulty":1200,"human_solution":"from math import sqrt\n\nn, v1, v2 = [int(i) for i in input().split()]\nx = [int(i) for i in input().split()]\nx1, y1 = [int(i) for i in input().split()]\n\nminim = x[1] \/ v1 + sqrt((x1-x[1])**2 + (y1)**2) \/ v2 #\u0412\u0440\u0435\u043c\u044f, \u0435\u0441\u043b\u0438 \u0441\u0442\u0443\u0434\u0435\u043d \u0432\u044b\u0439\u0434\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0438 \u043f\u043e\u0431\u0435\u0436\u0438\u0442 (\u0435\u0441\u043b\u0438 \u043e\u043d \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0430\u0432\u0442\u043e\u0431\u0443\u0441\u0430)\nres = 2\nfor i in range(2, n):\n t = x[i] \/ v1 + sqrt((x1-x[i])**2 + (y1)**2) \/ v2\n if t < minim:\n minim = t\n res = i + 1\n elif t == minim and sqrt((x1-x[res-1])**2 + (y1)**2) > sqrt((x1-x[i])**2 + (y1)**2):\n res = i+1\nprint(res)","testcases":"[{'input': '4 5 2\\r\\n0 2 4 6\\r\\n4 1\\r\\n', 'output': ['3']}, {'input': '2 1 1\\r\\n0 100000\\r\\n100000 100000\\r\\n', 'output': ['2']}, {'input': '6 5 1\\r\\n0 1 2 3 4 5\\r\\n0 0\\r\\n', 'output': ['2']}, {'input': '4 100 10\\r\\n0 118 121 178\\r\\n220 220\\r\\n', 'output': ['4']}, {'input': '4 3 3\\r\\n0 6 8 10\\r\\n7 -4\\r\\n', 'output': ['2']}, {'input': '5 900 1\\r\\n0 37474 80030 85359 97616\\r\\n-1 -1\\r\\n', 'output': ['2']}, {'input': '5 200 400\\r\\n0 8068 28563 51720 66113\\r\\n5423 -34\\r\\n', 'output': ['2']}, {'input': '6 10 3\\r\\n0 12 14 16 19 20\\r\\n14 0\\r\\n', 'output': ['3']}, {'input': '6 13 11\\r\\n0 16 27 31 39 42\\r\\n54 3\\r\\n', 'output': ['6']}, {'input': '11 853 721\\r\\n0 134 1971 2369 3381 3997 4452 6875 8983 9360 9399\\r\\n7345 333\\r\\n', 'output': ['8']}, {'input': '35 35 12\\r\\n0 90486 90543 90763 91127 91310 92047 92405 93654 93814 94633 94752 94969 94994 95287 96349 96362 96723 96855 96883 97470 97482 97683 97844 97926 98437 98724 98899 98921 99230 99253 99328 99444 99691 99947\\r\\n96233 -7777\\r\\n', 'output': ['9']}, {'input': '55 11 44\\r\\n0 3343 3387 3470 3825 3832 3971 4026 4043 4389 4492 4886 5015 5084 5161 5436 5595 5616 5677 5987 6251 6312 6369 6469 6487 6493 6507 6641 6928 7067 7159 7280 7303 7385 7387 7465 7536 7572 7664 7895 7921 7955 8110 8191 8243 8280 8523 8525 8581 8877 9221 9462 9505 9594 9596\\r\\n8000 0\\r\\n', 'output': ['2']}, {'input': '72 1000 777\\r\\n0 215 2814 5104 5226 5925 6734 9213 11697 13739 14015 16101 17234 19013 19566 19683 20283 20837 21332 21432 25490 26284 27728 29911 30112 30133 31494 31595 32499 32932 33289 36611 37736 43548 44440 44537 47656 47699 48327 50942 52178 53759 56925 57671 62024 65441 67958 70346 71606 75235 75466 75553 75905 76173 76512 77784 78183 80425 81339 81543 84537 88384 89953 90214 92107 92274 93328 93550 93987 97546 99459 99532\\r\\n63421 35\\r\\n', 'output': ['45']}, {'input': '76 1 1\\r\\n0 1000 1754 2749 3687 4983 8121 10299 11043 12986 14125 15910 17070 17189 17551 17953 17973 20816 25436 26150 27446 27788 28466 28941 29537 33965 37566 40845 40930 41304 41614 41615 43042 45098 45844 49878 50453 50936 55480 58410 59258 59287 62789 64127 64333 64450 64862 65404 66451 67626 69294 69804 71988 72165 74196 74560 75407 76611 77055 77344 79470 83566 84550 87458 87627 88205 89880 90255 90586 91970 93795 95308 99032 99442 99547 99549\\r\\n0 0\\r\\n', 'output': ['2']}, {'input': '94 2 1\\r\\n0 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093\\r\\n5050 -100000\\r\\n', 'output': ['2']}, {'input': '100 1 2\\r\\n0 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\\r\\n100 0\\r\\n', 'output': ['2']}, {'input': '100 1000 1\\r\\n0 505 506 514 515 520 523 527 529 530 538 547 550 554 559 562 566 568 569 580 582 584 588 597 609 621 624 629 630 631 634 641 646 653 657 666 673 678 680 683 685 690 695 698 699 700 705 709 716 731 734 735 736 738 756 761 762 765 769 772 776 779 784 790 794 812 814 816 833 837 842 845 850 854 855 863 868 872 882 892 893 898 899 900 901 902 915 916 917 932 936 954 962 968 975 978 983 992 996 998\\r\\n600 7778\\r\\n', 'output': ['23']}, {'input': '2 1 1\\r\\n0 100000\\r\\n-100000 -100000\\r\\n', 'output': ['2']}, {'input': '2 1000 1000\\r\\n0 1\\r\\n1 0\\r\\n', 'output': ['2']}, {'input': '3 1 1\\r\\n0 1 2\\r\\n2 0\\r\\n', 'output': ['3']}]","id":140} {"description":"A new cottage village called \u00abFlatville\u00bb is being built in Flatland. By now they have already built in \u00abFlatville\u00bb n square houses with the centres on the \u041ex-axis. The houses' sides are parallel to the coordinate axes. It's known that no two houses overlap, but they can touch each other.The architect bureau, where Peter works, was commissioned to build a new house in \u00abFlatville\u00bb. The customer wants his future house to be on the \u041ex-axis, to be square in shape, have a side t, and touch at least one of the already built houses. For sure, its sides should be parallel to the coordinate axes, its centre should be on the Ox-axis and it shouldn't overlap any of the houses in the village.Peter was given a list of all the houses in \u00abFlatville\u00bb. Would you help him find the amount of possible positions of the new house?","input_specification":"The first line of the input data contains numbers n and t (1\u2009\u2264\u2009n,\u2009t\u2009\u2264\u20091000). Then there follow n lines, each of them contains two space-separated integer numbers: xi ai, where xi \u2014 x-coordinate of the centre of the i-th house, and ai \u2014 length of its side (\u2009-\u20091000\u2009\u2264\u2009xi\u2009\u2264\u20091000, 1\u2009\u2264\u2009ai\u2009\u2264\u20091000).","output_specification":"Output the amount of possible positions of the new house.","notes":"NoteIt is possible for the x-coordinate of the new house to have non-integer value.","sample_inputs":["2 2\n0 4\n6 2","2 2\n0 4\n5 2","2 3\n0 4\n5 2"],"sample_outputs":["4","3","2"],"src_uid":"c31fed523230af1f904218b2fe0d663d","lang_cluster":"Python","difficulty":1200,"human_solution":"#15A - Cottage Village\n# n - how many square houses we have on the x-axis\n# t - the side of the main house\nn, t = map(int, input().split())\n#Variable that sorts square houses by x-axis coordinates in ascending order\n#Input: house's center on the x-axis and the house's side length\nhouses = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: x[0])\n#Because there's at least 1 other house in the village, we have 2 possibilities\n#by default, cause the main house can touch one of the 2 exposed sides of the other house\nans = 2\n#The next loop computes the number of houses that fit between 2 adjacent houses \nfor i in range(n - 1):\n x = houses[i][0] + houses[i][1] \/ 2\n y = houses[i + 1][0] - houses[i + 1][1] \/ 2\n #If the space between the 2 houses is equal to the main house's side,\n #the only way we can place our house is to touch both houses at the same time\n if y - x == t:\n ans += 1\n #If the space between the houses is bigger than the main house's side, \n #then we consider the 2 houses as 2 separate cases, each with 2 possibilities\n #of their own\n elif y - x > t:\n ans += 2\n \nprint(ans)","testcases":"[{'input': '2 2\\r\\n0 4\\r\\n6 2\\r\\n', 'output': ['4\\r\\n']}, {'input': '2 2\\r\\n0 4\\r\\n5 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 3\\r\\n0 4\\r\\n5 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 2\\r\\n2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 1\\r\\n2 1\\r\\n1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 2\\r\\n0 4\\r\\n7 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '4 1\\r\\n-12 1\\r\\n-14 1\\r\\n4 1\\r\\n-11 1\\r\\n', 'output': ['5\\r\\n']}, {'input': '6 15\\r\\n19 1\\r\\n2 3\\r\\n6 2\\r\\n-21 2\\r\\n-15 2\\r\\n23 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '10 21\\r\\n-61 6\\r\\n55 2\\r\\n-97 1\\r\\n37 1\\r\\n-39 1\\r\\n26 2\\r\\n21 1\\r\\n64 3\\r\\n-68 1\\r\\n-28 6\\r\\n', 'output': ['6\\r\\n']}, {'input': '26 51\\r\\n783 54\\r\\n-850 6\\r\\n-997 59\\r\\n573 31\\r\\n-125 20\\r\\n472 52\\r\\n101 5\\r\\n-561 4\\r\\n625 35\\r\\n911 14\\r\\n-47 33\\r\\n677 55\\r\\n-410 54\\r\\n13 53\\r\\n173 31\\r\\n968 30\\r\\n-497 7\\r\\n832 42\\r\\n271 59\\r\\n-638 52\\r\\n-301 51\\r\\n378 36\\r\\n-813 7\\r\\n-206 22\\r\\n-737 37\\r\\n-911 9\\r\\n', 'output': ['35\\r\\n']}, {'input': '14 101\\r\\n121 88\\r\\n-452 91\\r\\n635 28\\r\\n-162 59\\r\\n-872 26\\r\\n-996 8\\r\\n468 86\\r\\n742 63\\r\\n892 89\\r\\n-249 107\\r\\n300 51\\r\\n-753 17\\r\\n-620 31\\r\\n-13 34\\r\\n', 'output': ['16\\r\\n']}, {'input': '3 501\\r\\n827 327\\r\\n-85 480\\r\\n-999 343\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 999\\r\\n-999 471\\r\\n530 588\\r\\n', 'output': ['4\\r\\n']}, {'input': '22 54\\r\\n600 43\\r\\n806 19\\r\\n-269 43\\r\\n-384 78\\r\\n222 34\\r\\n392 10\\r\\n318 30\\r\\n488 73\\r\\n-756 49\\r\\n-662 22\\r\\n-568 50\\r\\n-486 16\\r\\n-470 2\\r\\n96 66\\r\\n864 16\\r\\n934 15\\r\\n697 43\\r\\n-154 30\\r\\n775 5\\r\\n-876 71\\r\\n-33 78\\r\\n-991 31\\r\\n', 'output': ['30\\r\\n']}, {'input': '17 109\\r\\n52 7\\r\\n216 24\\r\\n-553 101\\r\\n543 39\\r\\n391 92\\r\\n-904 67\\r\\n95 34\\r\\n132 14\\r\\n730 103\\r\\n952 118\\r\\n-389 41\\r\\n-324 36\\r\\n-74 2\\r\\n-147 99\\r\\n-740 33\\r\\n233 1\\r\\n-995 3\\r\\n', 'output': ['16\\r\\n']}, {'input': '4 512\\r\\n-997 354\\r\\n-568 216\\r\\n-234 221\\r\\n603 403\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 966\\r\\n988 5\\r\\n15 2\\r\\n-992 79\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 1000\\r\\n-995 201\\r\\n206 194\\r\\n', 'output': ['4\\r\\n']}, {'input': '50 21\\r\\n-178 1\\r\\n49 1\\r\\n-98 1\\r\\n-220 1\\r\\n152 1\\r\\n-160 3\\r\\n17 2\\r\\n77 1\\r\\n-24 1\\r\\n214 2\\r\\n-154 2\\r\\n-141 1\\r\\n79 1\\r\\n206 1\\r\\n8 1\\r\\n-208 1\\r\\n36 1\\r\\n231 3\\r\\n-2 2\\r\\n-130 2\\r\\n-14 2\\r\\n34 1\\r\\n-187 2\\r\\n14 1\\r\\n-83 2\\r\\n-241 1\\r\\n149 2\\r\\n73 1\\r\\n-233 3\\r\\n-45 1\\r\\n197 1\\r\\n145 2\\r\\n-127 2\\r\\n-229 4\\r\\n-85 1\\r\\n-66 1\\r\\n-76 2\\r\\n104 1\\r\\n175 1\\r\\n70 1\\r\\n131 3\\r\\n-108 1\\r\\n-5 4\\r\\n140 1\\r\\n33 1\\r\\n248 3\\r\\n-36 3\\r\\n134 1\\r\\n-183 1\\r\\n56 2\\r\\n', 'output': ['9\\r\\n']}, {'input': '50 1\\r\\n37 1\\r\\n-38 1\\r\\n7 1\\r\\n47 1\\r\\n-4 1\\r\\n24 1\\r\\n-32 1\\r\\n-23 1\\r\\n-3 1\\r\\n-19 1\\r\\n5 1\\r\\n-50 1\\r\\n11 1\\r\\n-11 1\\r\\n49 1\\r\\n-39 1\\r\\n0 1\\r\\n43 1\\r\\n-10 1\\r\\n6 1\\r\\n19 1\\r\\n1 1\\r\\n27 1\\r\\n29 1\\r\\n-47 1\\r\\n-40 1\\r\\n-46 1\\r\\n-26 1\\r\\n-42 1\\r\\n-37 1\\r\\n13 1\\r\\n-29 1\\r\\n-30 1\\r\\n3 1\\r\\n44 1\\r\\n10 1\\r\\n4 1\\r\\n-14 1\\r\\n-2 1\\r\\n34 1\\r\\n18 1\\r\\n-33 1\\r\\n-44 1\\r\\n9 1\\r\\n-36 1\\r\\n-7 1\\r\\n25 1\\r\\n22 1\\r\\n-20 1\\r\\n-41 1\\r\\n', 'output': ['43\\r\\n']}, {'input': '50 1\\r\\n-967 7\\r\\n696 7\\r\\n-366 4\\r\\n557 1\\r\\n978 2\\r\\n800 4\\r\\n-161 2\\r\\n-773 2\\r\\n-248 2\\r\\n134 3\\r\\n869 6\\r\\n-932 2\\r\\n-262 14\\r\\n191 3\\r\\n669 2\\r\\n72 5\\r\\n0 1\\r\\n757 8\\r\\n859 2\\r\\n-131 8\\r\\n-169 3\\r\\n543 10\\r\\n-120 2\\r\\n-87 8\\r\\n-936 6\\r\\n-620 3\\r\\n-281 11\\r\\n684 3\\r\\n886 10\\r\\n497 4\\r\\n380 4\\r\\n833 1\\r\\n-727 6\\r\\n470 11\\r\\n584 9\\r\\n66 6\\r\\n-609 12\\r\\n-661 4\\r\\n-57 8\\r\\n628 7\\r\\n635 4\\r\\n-924 3\\r\\n-982 4\\r\\n-201 7\\r\\n-9 8\\r\\n-560 9\\r\\n712 7\\r\\n-330 8\\r\\n-191 1\\r\\n-892 7\\r\\n', 'output': ['96\\r\\n']}, {'input': '1 1000\\r\\n0 1000\\r\\n', 'output': ['2\\r\\n']}]","id":141} {"description":"Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three digits.","input_specification":"The first line contains integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of digits in the phone number. The second line contains n digits \u2014 the phone number to divide into groups.","output_specification":"Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.","notes":null,"sample_inputs":["6\n549871","7\n1198733"],"sample_outputs":["54-98-71","11-987-33"],"src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","lang_cluster":"Python","difficulty":1100,"human_solution":"import sys\n\n\ndef digits(phone_number):\n if phone_number:\n phone_number = phone_number.rstrip('\\r|\\n')\n length = len(phone_number)\n\n # Not even.\n if length in [2, 3]:\n return phone_number\n elif length % 2:\n return phone_number[0:3] + \"-\" + digits(phone_number[3:])\n return phone_number[0:2] + \"-\" + digits(phone_number[2:])\n else:\n return phone_number\n\nif __name__ == '__main__':\n data = []\n for line in sys.stdin:\n data.append(line)\n\n for l in data[1::2]:\n print(digits(l))\n","testcases":"[{'input': '6\\r\\n549871\\r\\n', 'output': ['54-98-71']}, {'input': '7\\r\\n1198733\\r\\n', 'output': ['119-87-33']}, {'input': '2\\r\\n74\\r\\n', 'output': ['74']}, {'input': '2\\r\\n33\\r\\n', 'output': ['33']}, {'input': '3\\r\\n074\\r\\n', 'output': ['074']}, {'input': '3\\r\\n081\\r\\n', 'output': ['081']}, {'input': '4\\r\\n3811\\r\\n', 'output': ['38-11']}, {'input': '5\\r\\n21583\\r\\n', 'output': ['215-83']}, {'input': '8\\r\\n33408349\\r\\n', 'output': ['33-40-83-49']}, {'input': '9\\r\\n988808426\\r\\n', 'output': ['988-80-84-26']}, {'input': '10\\r\\n0180990956\\r\\n', 'output': ['01-80-99-09-56']}, {'input': '15\\r\\n433488906230138\\r\\n', 'output': ['433-48-89-06-23-01-38']}, {'input': '22\\r\\n7135498415686025907059\\r\\n', 'output': ['71-35-49-84-15-68-60-25-90-70-59']}, {'input': '49\\r\\n2429965524999668169991253653390090510755018570235\\r\\n', 'output': ['242-99-65-52-49-99-66-81-69-99-12-53-65-33-90-09-05-10-75-50-18-57-02-35']}, {'input': '72\\r\\n491925337784111770500147619881727525570039735507439360627744863794794290\\r\\n', 'output': ['49-19-25-33-77-84-11-17-70-50-01-47-61-98-81-72-75-25-57-00-39-73-55-07-43-93-60-62-77-44-86-37-94-79-42-90']}, {'input': '95\\r\\n32543414456047900690980198395035321172843693417425457554204776648220562494524275489599199209210\\r\\n', 'output': ['325-43-41-44-56-04-79-00-69-09-80-19-83-95-03-53-21-17-28-43-69-34-17-42-54-57-55-42-04-77-66-48-22-05-62-49-45-24-27-54-89-59-91-99-20-92-10']}, {'input': '97\\r\\n9362344595153688016434451101547661156123505108492010669557671355055642365998461003851354321478898\\r\\n', 'output': ['936-23-44-59-51-53-68-80-16-43-44-51-10-15-47-66-11-56-12-35-05-10-84-92-01-06-69-55-76-71-35-50-55-64-23-65-99-84-61-00-38-51-35-43-21-47-88-98']}, {'input': '98\\r\\n65521815795893886057122984634320900545031770769333931308009346017867969790810907868670369236928568\\r\\n', 'output': ['65-52-18-15-79-58-93-88-60-57-12-29-84-63-43-20-90-05-45-03-17-70-76-93-33-93-13-08-00-93-46-01-78-67-96-97-90-81-09-07-86-86-70-36-92-36-92-85-68']}, {'input': '99\\r\\n455213856470326729480192345541970106407563996625458559297407682539801838244443866898560852503660390\\r\\n', 'output': ['455-21-38-56-47-03-26-72-94-80-19-23-45-54-19-70-10-64-07-56-39-96-62-54-58-55-92-97-40-76-82-53-98-01-83-82-44-44-38-66-89-85-60-85-25-03-66-03-90']}, {'input': '100\\r\\n4004223124942730640235383244438257614581534320356060987241659784249551110165034719443327659510644224\\r\\n', 'output': ['40-04-22-31-24-94-27-30-64-02-35-38-32-44-43-82-57-61-45-81-53-43-20-35-60-60-98-72-41-65-97-84-24-95-51-11-01-65-03-47-19-44-33-27-65-95-10-64-42-24']}]","id":142} {"description":"A long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.The total income A of his kingdom during 0-th year is known, as well as the total income B during n-th year (these numbers can be negative \u2014 it means that there was a loss in the correspondent year). King wants to show financial stability. To do this, he needs to find common coefficient X \u2014 the coefficient of income growth during one year. This coefficient should satisfy the equation:A\u00b7Xn\u2009=\u2009B.Surely, the king is not going to do this job by himself, and demands you to find such number X.It is necessary to point out that the fractional numbers are not used in kingdom's economy. That's why all input numbers as well as coefficient X must be integers. The number X may be zero or negative.","input_specification":"The input contains three integers A, B, n (|A|,\u2009|B|\u2009\u2264\u20091000, 1\u2009\u2264\u2009n\u2009\u2264\u200910).","output_specification":"Output the required integer coefficient X, or \u00abNo solution\u00bb, if such a coefficient does not exist or it is fractional. If there are several possible solutions, output any of them.","notes":null,"sample_inputs":["2 18 2","-1 8 3","0 0 10","1 16 5"],"sample_outputs":["3","-2","5","No solution"],"src_uid":"8a9adc116abbd387a6a64dd754436f8a","lang_cluster":"Python","difficulty":1400,"human_solution":"a,b,n = map(int,input().split())\nans = \"No solution\"\n\nif a == 0 and b == 0:\n ans =5\nelif a == 0 and b!= 0:\n ans\nelif a != 0 and b == 0:\n ans = 0\nelif b%a != 0:\n ans\nelse:\n a = b \/ a\n if a < 0 :\n a = abs(a)\n b = 0\n for i in range(1001):\n if i ** n == a:\n ans = i\n\n if b == 0 :ans = - ans\n\nprint(ans)\n","testcases":"[{'input': '2 18 2\\r\\n', 'output': ['3']}, {'input': '-1 8 3\\r\\n', 'output': ['-2']}, {'input': '0 0 10\\r\\n', 'output': ['5']}, {'input': '1 16 5\\r\\n', 'output': ['No solution']}, {'input': '0 1 2\\r\\n', 'output': ['No solution']}, {'input': '3 0 4\\r\\n', 'output': ['0']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '4 972 1\\r\\n', 'output': ['243']}, {'input': '-1 -1 5\\r\\n', 'output': ['1']}, {'input': '-1 0 4\\r\\n', 'output': ['0']}, {'input': '-7 0 1\\r\\n', 'output': ['0']}, {'input': '-5 -5 3\\r\\n', 'output': ['1']}, {'input': '-5 -5 9\\r\\n', 'output': ['1']}, {'input': '-5 -5 6\\r\\n', 'output': ['1']}, {'input': '-4 0 1\\r\\n', 'output': ['0']}, {'input': '-5 0 3\\r\\n', 'output': ['0']}, {'input': '-4 4 9\\r\\n', 'output': ['-1']}, {'input': '10 0 6\\r\\n', 'output': ['0']}, {'input': '-5 3 4\\r\\n', 'output': ['No solution']}, {'input': '0 3 6\\r\\n', 'output': ['No solution']}, {'input': '3 6 10\\r\\n', 'output': ['No solution']}, {'input': '-3 7 5\\r\\n', 'output': ['No solution']}, {'input': '-526 526 1\\r\\n', 'output': ['-1']}, {'input': '-373 373 3\\r\\n', 'output': ['-1']}, {'input': '-141 0 8\\r\\n', 'output': ['0']}, {'input': '7 175 1\\r\\n', 'output': ['25']}, {'input': '-5 -560 1\\r\\n', 'output': ['112']}, {'input': '-1 -512 10\\r\\n', 'output': ['No solution']}, {'input': '-3 -768 8\\r\\n', 'output': ['2']}, {'input': '-3 -768 7\\r\\n', 'output': ['No solution']}, {'input': '-3 -768 9\\r\\n', 'output': ['No solution']}, {'input': '-3 -768 4\\r\\n', 'output': ['4']}, {'input': '4 972 4\\r\\n', 'output': ['No solution']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '4 972 6\\r\\n', 'output': ['No solution']}, {'input': '4 972 1\\r\\n', 'output': ['243']}, {'input': '4 972 2\\r\\n', 'output': ['No solution']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '1 961 2\\r\\n', 'output': ['31']}, {'input': '1 1000 3\\r\\n', 'output': ['10']}, {'input': '1 625 4\\r\\n', 'output': ['5']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '1 729 6\\r\\n', 'output': ['3']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '3 768 8\\r\\n', 'output': ['2']}, {'input': '1 512 9\\r\\n', 'output': ['2']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '1 961 2\\r\\n', 'output': ['31']}, {'input': '1 1000 3\\r\\n', 'output': ['10']}, {'input': '1 625 4\\r\\n', 'output': ['5']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '1 729 6\\r\\n', 'output': ['3']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '3 768 8\\r\\n', 'output': ['2']}, {'input': '1 512 9\\r\\n', 'output': ['2']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '1 961 2\\r\\n', 'output': ['31']}, {'input': '1 1000 3\\r\\n', 'output': ['10']}, {'input': '1 625 4\\r\\n', 'output': ['5']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '1 729 6\\r\\n', 'output': ['3']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '3 768 8\\r\\n', 'output': ['2']}, {'input': '1 512 9\\r\\n', 'output': ['2']}, {'input': '1 1 5\\r\\n', 'output': ['1']}, {'input': '1 1 4\\r\\n', 'output': ['1']}, {'input': '1 -1 1\\r\\n', 'output': ['-1']}]","id":143} {"description":"In a strategic computer game \"Settlers II\" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either increase or decrease.Every soldier has a rank \u2014 some natural number from 1 to k. 1 stands for a private and k stands for a general. The higher the rank of the soldier is, the better he fights. Therefore, the player profits from having the soldiers of the highest possible rank.To increase the ranks of soldiers they need to train. But the soldiers won't train for free, and each training session requires one golden coin. On each training session all the n soldiers are present.At the end of each training session the soldiers' ranks increase as follows. First all the soldiers are divided into groups with the same rank, so that the least possible number of groups is formed. Then, within each of the groups where the soldiers below the rank k are present, exactly one soldier increases his rank by one.You know the ranks of all n soldiers at the moment. Determine the number of golden coins that are needed to increase the ranks of all the soldiers to the rank k.","input_specification":"The first line contains two integers n and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u2009100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1\u2009\u2264\u2009i\u2009\u2264\u2009n, 1\u2009\u2264\u2009ai\u2009\u2264\u2009k).","output_specification":"Print a single integer \u2014 the number of golden coins needed to raise all the soldiers to the maximal rank.","notes":"NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 \u2009\u2192\u2009 2 2 3 4 \u2009\u2192\u2009 2 3 4 4 \u2009\u2192\u2009 3 4 4 4 \u2009\u2192\u2009 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.","sample_inputs":["4 4\n1 2 2 3","4 3\n1 1 1 1"],"sample_outputs":["4","5"],"src_uid":"3d6411d67c85f6293f1999ccff2cd8ba","lang_cluster":"Python","difficulty":1200,"human_solution":"# -*- coding: utf-8 -*-\n\nN , K = [int(n) for n in raw_input().split(\" \")]\nr = []\nnum = raw_input().split(\" \")\n#N , K = 100 , 100\n#num = [1 for i in xrange(100)]\n\nfor i in xrange(K):\n r.append(0)\nfor n in num:\n t = int(n)\n r[t - 1] += 1\ncnt = 0\nwhile True:\n i = 0\n while i < K - 1 and r[i] == 0:\n i += 1\n if i == K - 1:\n break\n for i in xrange(K - 2 , -1 , -1):\n #print i,\n if r[i] != 0:\n r[i] -= 1\n r[i + 1] += 1\n #print\n cnt += 1\nprint cnt\n","testcases":"[{'input': '4 4\\r\\n1 2 2 3\\r\\n', 'output': ['4']}, {'input': '4 3\\r\\n1 1 1 1\\r\\n', 'output': ['5']}, {'input': '3 3\\r\\n1 2 3\\r\\n', 'output': ['2']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '1 5\\r\\n1\\r\\n', 'output': ['4']}, {'input': '1 5\\r\\n4\\r\\n', 'output': ['1']}, {'input': '2 6\\r\\n2 5\\r\\n', 'output': ['4']}, {'input': '6 10\\r\\n1 1 3 4 9 9\\r\\n', 'output': ['10']}, {'input': '7 7\\r\\n1 1 1 1 1 1 7\\r\\n', 'output': ['11']}, {'input': '10 10\\r\\n1 1 1 3 3 4 7 8 8 8\\r\\n', 'output': ['11']}, {'input': '10 13\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['21']}, {'input': '10 13\\r\\n2 6 6 7 9 9 9 10 12 12\\r\\n', 'output': ['11']}, {'input': '17 9\\r\\n2 3 4 5 5 5 5 5 6 6 7 7 8 8 8 8 8\\r\\n', 'output': ['17']}, {'input': '18 24\\r\\n3 3 3 4 5 7 8 8 9 9 9 9 10 10 11 11 11 11\\r\\n', 'output': ['30']}, {'input': '23 2\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2\\r\\n', 'output': ['12']}, {'input': '37 42\\r\\n1 1 1 1 1 2 2 2 2 2 3 4 4 4 4 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8\\r\\n', 'output': ['70']}, {'input': '44 50\\r\\n38 38 38 38 38 38 38 39 39 39 39 39 39 39 40 40 40 40 40 41 41 41 41 41 41 41 42 42 42 43 43 43 44 44 44 44 45 45 45 46 46 46 46 46\\r\\n', 'output': ['47']}, {'input': '57 100\\r\\n2 2 4 7 8 10 12 12 14 15 16 18 19 21 21 22 25 26 26 33 38 40 44 44 44 45 47 47 50 51 51 54 54 54 54 55 56 58 61 65 67 68 68 70 74 75 78 79 83 86 89 90 92 95 96 96 97\\r\\n', 'output': ['99']}, {'input': '78 10\\r\\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['78']}, {'input': '96 78\\r\\n20 20 20 20 20 21 21 21 22 23 23 24 24 25 25 27 28 29 30 30 30 32 32 32 33 33 33 33 34 34 35 36 37 37 39 39 41 41 41 41 42 42 43 43 43 44 44 45 46 46 48 48 49 50 51 51 51 52 53 55 55 56 56 56 56 57 58 59 60 61 61 61 62 62 62 63 63 64 64 64 65 65 65 66 66 67 68 69 71 72 72 73 73 75 75 75\\r\\n', 'output': ['98']}, {'input': '100 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['0']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['198']}, {'input': '100 100\\r\\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\\r\\n', 'output': ['0']}, {'input': '100 100\\r\\n1 1 4 4 5 5 7 9 10 10 11 11 12 12 12 13 14 15 16 16 16 17 18 18 19 20 22 25 26 27 29 32 33 34 34 35 35 35 36 36 37 37 38 39 39 40 41 42 44 44 46 47 47 47 47 50 53 53 53 55 56 56 57 57 58 58 59 59 62 64 64 64 64 68 68 68 69 70 70 71 74 77 77 77 79 80 80 81 84 86 88 88 91 93 94 96 96 99 99 99\\r\\n', 'output': ['108']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 8 8 8 8 8 9 9 9 9 9 9 9 10 10 10 10 10 11 11 11 11 11 12 12 12 12 12 12 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14 14 15 15 15 15 15\\r\\n', 'output': ['184']}, {'input': '100 100\\r\\n20 20 20 21 21 21 21 21 22 23 23 23 23 23 23 24 24 25 25 26 26 26 26 26 27 27 27 27 28 28 28 28 29 29 29 29 29 30 30 30 30 31 32 32 34 34 34 34 34 34 34 34 35 35 35 36 36 37 37 37 37 37 37 38 38 38 39 40 41 41 42 42 42 42 42 43 43 43 44 44 44 44 44 45 45 45 45 45 46 46 46 46 46 47 47 47 48 48 48 50\\r\\n', 'output': ['150']}, {'input': '100 2\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n', 'output': ['59']}, {'input': '30 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 49\\r\\n', 'output': ['77']}, {'input': '40 20\\r\\n5 5 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 20 20 20 20 20 20 20 20 20 20\\r\\n', 'output': ['31']}, {'input': '81 90\\r\\n1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90\\r\\n', 'output': ['89']}, {'input': '100 20\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['106']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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\\r\\n', 'output': ['197']}, {'input': '100 100\\r\\n49 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 51\\r\\n', 'output': ['148']}, {'input': '1 100\\r\\n1\\r\\n', 'output': ['99']}, {'input': '4 3\\r\\n1 1 2 2\\r\\n', 'output': ['4']}, {'input': '10 100\\r\\n98 99 99 99 99 99 99 100 100 100\\r\\n', 'output': ['7']}, {'input': '5 100\\r\\n1 2 2 100 100\\r\\n', 'output': ['100']}]","id":144} {"description":"Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1\u2009\u00d7\u2009n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed height and due to the newest irrigation system we can create artificial rain above each section.Creating artificial rain is an expensive operation. That's why we limit ourselves to creating the artificial rain only above one section. At that, the water from each watered section will flow into its neighbouring sections if their height does not exceed the height of the section. That is, for example, the garden can be represented by a 1\u2009\u00d7\u20095 rectangle, where the section heights are equal to 4, 2, 3, 3, 2. Then if we create an artificial rain over any of the sections with the height of 3, the water will flow over all the sections, except the ones with the height of 4. See the illustration of this example at the picture: As Petya is keen on programming, he decided to find such a section that if we create artificial rain above it, the number of watered sections will be maximal. Help him. ","input_specification":"The first line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.","output_specification":"Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.","notes":null,"sample_inputs":["1\n2","5\n1 2 1 2 1","8\n1 2 1 1 1 3 3 4"],"sample_outputs":["1","3","6"],"src_uid":"5d11fa8528f1dc873d50b3417bef8c79","lang_cluster":"Python","difficulty":1100,"human_solution":"t = int(raw_input())\nN = []\nN.append(10000)\n[N.append(int(i)) for i in raw_input().split()]\nsol = 0\ndpx, dpy = [0]*2000, [0]*2000\n\nN.append(10000)\nfor i in range(1, t+1):\n if N[i] >= N[i - 1]:\n dpy[i] = dpy[i - 1] + 1\n else:\n dpy[i] = 1\n\nfor i in range(t, 0, -1):\n if N[i] >= N[i + 1]:\n dpx[i] = dpx[i + 1] + 1\n else:\n dpx[i] = 1\n\nfor i in range(1, t+1):\n if dpy[i] + dpx[i] - 1 > sol:\n sol = dpx[i] + dpy[i] - 1\n\nprint sol\n","testcases":"[{'input': '1\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 2 1 2 1\\r\\n', 'output': ['3\\r\\n']}, {'input': '8\\r\\n1 2 1 1 1 3 3 4\\r\\n', 'output': ['6\\r\\n']}, {'input': '10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n', 'output': ['10\\r\\n']}, {'input': '10\\r\\n10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['10\\r\\n']}, {'input': '2\\r\\n100 100\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n100 100 100\\r\\n', 'output': ['3\\r\\n']}, {'input': '11\\r\\n1 2 3 4 5 6 5 4 3 2 1\\r\\n', 'output': ['11\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 100 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 1 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['61\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 100 5 4 3 2 1\\r\\n', 'output': ['81\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 1 86 87 88 89 90 91 92 93 100 6 5 4 3 2 1\\r\\n', 'output': ['85\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 1 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 100 7 6 5 4 3 2 1\\r\\n', 'output': ['61\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 100 8 7 6 1 4 3 2 1\\r\\n', 'output': ['96\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 100 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['100\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 1 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 100 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['55\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 1 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 100 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['59\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 100 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['86\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 100 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['83\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 100 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 1 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['74\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 100 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['100\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 100 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 1 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['52\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 100 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 1 2 1\\r\\n', 'output': ['98\\r\\n']}, {'input': '10\\r\\n1 4 4 4 4 4 1 2 4 3\\r\\n', 'output': ['7\\r\\n']}]","id":145} {"description":"n soldiers stand in a circle. For each soldier his height ai is known. A reconnaissance unit can be made of such two neighbouring soldiers, whose heights difference is minimal, i.e. |ai\u2009-\u2009aj| is minimal. So each of them will be less noticeable with the other. Output any pair of soldiers that can form a reconnaissance unit.","input_specification":"The first line contains integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of soldiers. Then follow the heights of the soldiers in their order in the circle \u2014 n space-separated integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u20091000). The soldier heights are given in clockwise or counterclockwise direction.","output_specification":"Output two integers \u2014 indexes of neighbouring soldiers, who should form a reconnaissance unit. If there are many optimum solutions, output any of them. Remember, that the soldiers stand in a circle.","notes":null,"sample_inputs":["5\n10 12 13 15 10","4\n10 20 30 40"],"sample_outputs":["5 1","1 2"],"src_uid":"facd9cd4fc1e53f50a1e6f947d78e942","lang_cluster":"Python","difficulty":800,"human_solution":"n = int(input())\nl = list(map(int,input().split()))\nl.append(l[0])\n# print(l)\nm = abs(l[1]-l[0])\n# print(m)\na = 1\nfor i in range(2,n+1):\n if(abs(l[i]-l[i-1]))=q:\n er+=1\n else:\n pass\n i+=1\n#print(n)\n#print(er)\nif er==n:\n print('YES')\n\nelse:\n print('NO')\n\n\n","testcases":"[{'input': 'Instead of dogging Your footsteps it disappears but you dont notice anything\\r\\nwhere is your dog\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'Instead of dogging Your footsteps it disappears but you dont notice anything\\r\\nYour dog is upstears\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'Instead of dogging your footsteps it disappears but you dont notice anything\\r\\nYour dog is upstears\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'abcdefg hijk\\r\\nk j i h g f e d c b a\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'HpOKgo\\r\\neAtAVB\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'GRZGc\\r\\nLPzD\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'GtPXu\\r\\nd\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'FVF\\r\\nr \\r\\n', 'output': ['NO\\r\\n']}, {'input': 'HpOKgo\\r\\nogK\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'GRZGc\\r\\nZG\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'HpOKgoueAtAVBdGffvQheJDejNDHhhwyKJisugiRAH OseK yUwqPPNuThUxTfthqIUeb wS jChGOdFDarNrKRT MlwKecxWNoKEeD BbiHAruE XMlvKYVsJGPP\\r\\nAHN XvoaNwV AVBKwKjr u U K wKE D K Jy KiHsR h d W Js IHyMPK Br iSqe E fDA g H\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'GRZGcsLPzDrCSXhhNTaibJqVphhjbcPoZhCDUlzAbDnRWjHvxLKtpGiFWiGbfeDxBwCrdJmJGCGv GebAOinUsFrlqKTILOmxrFjSpEoVGoTdSSstJWVgMLKMPettxHASaQZNdOIObcTxtF qTHWBdNIKwj\\r\\nWqrxze Ji x q aT GllLrRV jMpGiMDTwwS JDsPGpAZKACmsFCOS CD Sj bCDgKF jJxa RddtLFAi VGLHH SecObzG q hPF \\r\\n', 'output': ['YES\\r\\n']}, {'input': 'GtPXuwdAxNhODQbjRslDDKciOALJrCifTjDQurQEBeFUUSZWwCZQPdYwZkYbrduMijFjgodAOrKIuUKwSXageZuOWMIhAMexyLRzFuzuXqBDTEaWMzVdbzhxDGSJC SsIYuYILwpiwwcObEHWpFvHeBkWYNitqYrxqgHReHcKnHbtjcWZuaxPBVPb\\r\\nTQIKyqFaewOkY lZUOOuxEw EwuKcArxRQGFYkvVWIAe SuanPeHuDjquurJu aSxwgOSw jYMwjxItNUUArQjO BIujAhSwttLWp\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'FVFSr unvtXbpKWF vPaAgNaoTqklzVqiGYcUcBIcattzBrRuNSnKUtmdGKbjcE\\r\\nUzrU K an GFGR Wc zt iBa P c T K v p V In b B c\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'lSwjnYLYtDNIZjxHiTawdh ntSzggZogcIZTuiTMWVgwyloMtEhqkrOxgIcFvwvsboXUPILPIymFAEXnhApewJXJNtFyZ\\r\\nAoxe jWZ u yImg o AZ FNI w lpj tNhT g y ZYcb rc J w Dlv\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'kvlekcdJqODUKdsJlXkRaileTmdGwUHWWgvgUokQxRzzbpFnswvNKiDnjfOFGvFcnaaiRnBGQmqoPxDHepgYasLhzjDgmvaFfVNEcSPVQCJKAbSyTGpXsAjIHr\\r\\nGjzUllNaGGKXUdYmDFpqFAKIwvTpjmqnyswWRTnxlBnavAGvavxJemrjvRJc\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'kWbvhgvvoYOhwXmgTwOSCDXrtFHhqwvMlCvsuuAUXMmWaYXiqHplFZZemhgkTuvsUtIaUxtyYauBIpjdbyYxjZ ZkaBPzwqPfqF kCqGRmXvWuabnQognnkvdNDtRUsSUvSzgBuxCMBWJifbxWegsknp\\r\\nBsH bWHJD n Ca T xq PRCv tatn Wjy sm I q s WCjFqdWe t W XUs Do eb Pfh ii hTbF O Fll\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'OTmLdkMhmDEOMQMiW ZpzEIjyElHFrNCfFQDp SZyoZaEIUIpyCHfwOUqiSkKtFHggrTBGkqfOxkChPztmPrsHoxVwAdrxbZLKxPXHlMnrkgMgiaHFopiFFiUEtKwCjpJtwdwkbJCgA bxeDIscFdmHQJLAMNhWlrZisQrHQpvbALWTwpf jnx\\r\\nDbZwrQbydCdkJMCrftiwtPFfpMiwwrfIrKidEChKECxQUBVUEfFirbGWiLkFQkdJiFtkrtkbIAEXCEDkwLpK\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'NwcGaIeSkOva\\r\\naIa\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'gSrAcVYgAdbdayzbKGhIzLDjyznLRIJH KyvilAaEddmgkBPCNzpmPNeGEbmmpAyHvUSoPvnaORrPUuafpReEGoDOQsAYnUHYfBqhdcopQfxJuGXgKnbdVMQNhJYkyjiJDKlShqBTtnnDQQzEijOMcYRGMgPGVhfIReYennKBLwDTVvcHMIHMgVpJkvzTrezxqS\\r\\nHJerIVvRyfrPgAQMTI AqGNO mQDfDwQHKgeeYmuRmozKHILvehMPOJNMRtPTAfvKvsoGKi xHEeKqDAYmQJPUXRJbIbHrgVOMGMTdvYiLui\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'ReB hksbHqQXxUgpvoNK bFqmNVCEiOyKdKcAJQRkpeohpfuqZabvrLfmpZOMcfyFBJGZwVMxiUPP pbZZtJjxhEwvrAba\\r\\nJTCpQnIViIGIdQtLnmkVzmcbBZR CoxAdTtWSYpbOglDFifqIVQ vfGKGtLpxpJHiHSWCMeRcrVOXBGBhoEnVhNTPWGTOErNtSvokcGdgZXbgTEtISUyTwaXUEIlJMmutsdCbiyrPZPJyRdOjnSuAGttLy\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'hrLzRegCuDGxTrhDgVvM KowwyYuXGzIpcXdSMgeQVfVOtJZdkhNYSegwFWWoPqcZoeapbQnyCtojgkcyezUNHGGIZrhzsKrvvcrtokIdcnqXXkCNKjrOjrnEAKBNxyDdiMVeyLvXxUYMZQRFdlcdlcxzKTeYzBlmpNiwWbNAAhWkMoGpRxkCuyqkzXdKWwGH\\r\\nJESKDOfnFdxPvUOCkrgSBEPQHJtJHzuNGstRbTCcchRWJvCcveSEAtwtOmZZiW\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'yDBxCtUygQwWqONxQCcuAvVCkMGlqgC zvkfEkwqbhMCQxnkwQIUhucCbVUyOBUcXvTNEGriTBwMDMfdsPZgWRgIUDqM\\r\\neptVnORTTyixxmWIBpSTEwOXqGZllBgSxPenYCDlFwckJlWsoVwWLAIbPOmFqcKcTcoQqahetl KLfVSyaLVebzsGwPSVbtQAeUdZAaJtfxlCEvvaRhLlVvRJhKat IaB awdqcDlrrhTbRxjEbzGwcdmdavkhcjHjzmwbxAgw\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'jlMwnnotSdlQMluKWkJwAeCetcqbIEnKeNyLWoKCGONDRBQOjbkGpUvDlmSFUJ bWhohqmmIUWTlDsvelUArAcZJBipMDwUvRfBsYzMdQnPDPAuBaeJmAxVKwUMJrwMDxNtlrtAowVWqWiwFGtmquZAcrpFsLHCrvMSMMlvQUqypAihQWrFMNoaqfs IBg\\r\\nNzeWQ bafrmDsYlpNHSGTBBgPl WIcuNhyNaNOEFvL\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'zyWvXBcUZqGqjHwZHQryBtFliLYnweXAoMKNpLaunaOlzaauWmLtywsEvWPiwxJapocAFRMjrqWJXYqfKEbBKnzLO\\r\\npsbi bsXpSeJaCkIuPWfSRADXdIClxcDCowwJzGCDTyAl\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'kKhuIwRPLCwPFfcnsyCfBdnsraGeOCcLTfXuGjqFSGPSAeDZJSS bXKFanNqWjpFnvRpWxHJspvisDlADJBioxXNbVoXeUedoPcNEpUyEeYxdJXhGzFAmpAiHotSVwbZQsuWjIVhVaEGgqbZHIoDpiEmjTtFylCwCkWWzUOoUfOHxEZvDwNpXhBWamHn\\r\\nK VpJjGhNbwCRhcfmNGVjewBFpEmPlIKeTuWiukDtEWpjgqciqglkyNfWrBLbGAKvlNWxaUelJmSlSoakSpRzePvJsshOsTYrMPXdxKpaShjyVIXGhRIAdtiGpNwtiRmGTBZhkJqIMdxMHX RMxCMYcWjcjhtCHyFnCvjjezGbkRDRiVxkbh\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'AXssNpFKyQmJcBdBdfkhhMUzfqJVgcLBddkwtnFSzSRUCjiDcdtmkzIGkCKSxWUEGhmHmciktJyGMkgCductyHx\\r\\nI nYhmJfPnvoKUiXYUBIPIcxNYTtvwPUoXERZvY ahlDpQFNMmVZqEBiYqYlHNqcpSCmhFczBlOAhsYFeqMGfqL EJsDNOgwoJfBzqijKOFcYQ\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'lkhrzDZmkdbjzYKPNMRkiwCFoZsMzBQMnxxdKKVJezSBjnLjPpUYtabcPTIaDJeDEobbWHdKOdVfMQwDXzDDcSrwVenDEYpMqfiOQ xSsqApWnAMoyhQXCKFzHvvzvUvkWwmwZrvZz\\r\\nsUzGspYpRFsHRbRgTQuCBgnFgPkisTUfFNwyEEWWRiweWWgjRkVQxgTwxOzdsOwfrGIH O gCXpzvHzfItuEHaihmugEyymSJIogYwX qAwcwIItidfnzZDhZgQHi eRjMAeVkJHceDZuJkmxGowOsmcGYYvk Ajtgi TxwihvjLViNZjvscTWvsaQUelTSivLShhEl\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'BRsVjyNhrqRHVwrJzuzRigEhdpbDmaACSPfed\\r\\nlWqKTjlrqOCUbgBBZdZDGCeQJDXawPnnDkQdZDgwrEQk\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'KRmINuyBYPwiTsdlyiNVuylToysJKmOpcLovAtwGPqrgFJQNAYvuAiyQRkeFMECVZvkDEmTauXlyjAaYRnTJXORMZRnTakBaUzSelMilejySDIZjQjzcOIrwXdvDvpeRIkoBgreyFXIyyIZutjiEBtwrmzQtPVUhvvdEtDMbXjBpoPVjGdM EXTAK JbCnw\\r\\nXZZqlJvzKKtvdNlzFPDTYxidqlsgufVzyEmO FZuLQ vVQsJESNviUCovCK NwwlbxsmPtOJNmAonCqrOZ bZ LVKAsQGmoLnYjeekvEIECFk\\r\\n', 'output': ['NO\\r\\n']}]","id":149} {"description":"A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count. The game goes as follows. Kids stand in circle. Let's agree to think of the children as numbered with numbers from 1 to n clockwise and the child number 1 is holding the ball. First the first child throws the ball to the next one clockwise, i.e. to the child number 2. Then the child number 2 throws the ball to the next but one child, i.e. to the child number 4, then the fourth child throws the ball to the child that stands two children away from him, i.e. to the child number 7, then the ball is thrown to the child who stands 3 children away from the child number 7, then the ball is thrown to the child who stands 4 children away from the last one, and so on. It should be mentioned that when a ball is thrown it may pass the beginning of the circle. For example, if n\u2009=\u20095, then after the third throw the child number 2 has the ball again. Overall, n\u2009-\u20091 throws are made, and the game ends.The problem is that not all the children get the ball during the game. If a child doesn't get the ball, he gets very upset and cries until Natalia Pavlovna gives him a candy. That's why Natalia Pavlovna asks you to help her to identify the numbers of the children who will get the ball after each throw.","input_specification":"The first line contains integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) which indicates the number of kids in the circle.","output_specification":"In the single line print n\u2009-\u20091 numbers which are the numbers of children who will get the ball after each throw. Separate the numbers by spaces.","notes":null,"sample_inputs":["10","3"],"sample_outputs":["2 4 7 1 6 2 9 7 6","2 1"],"src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","lang_cluster":"Python","difficulty":800,"human_solution":"def main():\n n = input()\n pos = 0\n for i in range(1, n):\n pos = (pos + i) % n\n print pos + 1,\n\nif __name__ == '__main__':\n main()\n","testcases":"[{'input': '10\\r\\n', 'output': ['2 4 7 1 6 2 9 7 6\\r\\n']}, {'input': '3\\r\\n', 'output': ['2 1\\r\\n']}, {'input': '4\\r\\n', 'output': ['2 4 3\\r\\n']}, {'input': '5\\r\\n', 'output': ['2 4 2 1\\r\\n']}, {'input': '6\\r\\n', 'output': ['2 4 1 5 4\\r\\n']}, {'input': '7\\r\\n', 'output': ['2 4 7 4 2 1\\r\\n']}, {'input': '8\\r\\n', 'output': ['2 4 7 3 8 6 5\\r\\n']}, {'input': '9\\r\\n', 'output': ['2 4 7 2 7 4 2 1\\r\\n']}, {'input': '2\\r\\n', 'output': ['2\\r\\n']}, {'input': '11\\r\\n', 'output': ['2 4 7 11 5 11 7 4 2 1\\r\\n']}, {'input': '12\\r\\n', 'output': ['2 4 7 11 4 10 5 1 10 8 7\\r\\n']}, {'input': '13\\r\\n', 'output': ['2 4 7 11 3 9 3 11 7 4 2 1\\r\\n']}, {'input': '20\\r\\n', 'output': ['2 4 7 11 16 2 9 17 6 16 7 19 12 6 1 17 14 12 11\\r\\n']}, {'input': '25\\r\\n', 'output': ['2 4 7 11 16 22 4 12 21 6 17 4 17 6 21 12 4 22 16 11 7 4 2 1\\r\\n']}, {'input': '30\\r\\n', 'output': ['2 4 7 11 16 22 29 7 16 26 7 19 2 16 1 17 4 22 11 1 22 14 7 1 26 22 19 17 16\\r\\n']}, {'input': '35\\r\\n', 'output': ['2 4 7 11 16 22 29 2 11 21 32 9 22 1 16 32 14 32 16 1 22 9 32 21 11 2 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '40\\r\\n', 'output': ['2 4 7 11 16 22 29 37 6 16 27 39 12 26 1 17 34 12 31 11 32 14 37 21 6 32 19 7 36 26 17 9 2 36 31 27 24 22 21\\r\\n']}, {'input': '45\\r\\n', 'output': ['2 4 7 11 16 22 29 37 1 11 22 34 2 16 31 2 19 37 11 31 7 29 7 31 11 37 19 2 31 16 2 34 22 11 1 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '50\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 6 17 29 42 6 21 37 4 22 41 11 32 4 27 1 26 2 29 7 36 16 47 29 12 46 31 17 4 42 31 21 12 4 47 41 36 32 29 27 26\\r\\n']}, {'input': '55\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 1 12 24 37 51 11 27 44 7 26 46 12 34 2 26 51 22 49 22 51 26 2 34 12 46 26 7 44 27 11 51 37 24 12 1 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '60\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 7 19 32 46 1 17 34 52 11 31 52 14 37 1 26 52 19 47 16 46 17 49 22 56 31 7 44 22 1 41 22 4 47 31 16 2 49 37 26 16 7 59 52 46 41 37 34 32 31\\r\\n']}, {'input': '65\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 2 14 27 41 56 7 24 42 61 16 37 59 17 41 1 27 54 17 46 11 42 9 42 11 46 17 54 27 1 41 17 59 37 16 61 42 24 7 56 41 27 14 2 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '70\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 9 22 36 51 67 14 32 51 1 22 44 67 21 46 2 29 57 16 46 7 39 2 36 1 37 4 42 11 51 22 64 37 11 56 32 9 57 36 16 67 49 32 16 1 57 44 32 21 11 2 64 57 51 46 42 39 37 36\\r\\n']}, {'input': '75\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 4 17 31 46 62 4 22 41 61 7 29 52 1 26 52 4 32 61 16 47 4 37 71 31 67 29 67 31 71 37 4 47 16 61 32 4 52 26 1 52 29 7 61 41 22 4 62 46 31 17 4 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '80\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 12 26 41 57 74 12 31 51 72 14 37 61 6 32 59 7 36 66 17 49 2 36 71 27 64 22 61 21 62 24 67 31 76 42 9 57 26 76 47 19 72 46 21 77 54 32 11 71 52 34 17 1 66 52 39 27 16 6 77 69 62 56 51 47 44 42 41\\r\\n']}, {'input': '85\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 7 21 36 52 69 2 21 41 62 84 22 46 71 12 39 67 11 41 72 19 52 1 36 72 24 62 16 56 12 54 12 56 16 62 24 72 36 1 52 19 72 41 11 67 39 12 71 46 22 84 62 41 21 2 69 52 36 21 7 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '90\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 2 16 31 47 64 82 11 31 52 74 7 31 56 82 19 47 76 16 47 79 22 56 1 37 74 22 61 11 52 4 47 1 46 2 49 7 56 16 67 29 82 46 11 67 34 2 61 31 2 64 37 11 76 52 29 7 76 56 37 19 2 76 61 47 34 22 11 1 82 74 67 61 56 52 49 47 46\\r\\n']}, {'input': '95\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 11 26 42 59 77 1 21 42 64 87 16 41 67 94 27 56 86 22 54 87 26 61 2 39 77 21 61 7 49 92 41 86 37 84 37 86 41 92 49 7 61 21 77 39 2 61 26 87 54 22 86 56 27 94 67 41 16 87 64 42 21 1 77 59 42 26 11 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '96\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 10 25 41 58 76 95 19 40 62 85 13 38 64 91 23 52 82 17 49 82 20 55 91 32 70 13 53 94 40 83 31 76 26 73 25 74 28 79 35 88 46 5 61 22 80 43 7 68 34 1 65 34 4 71 43 16 86 61 37 14 88 67 47 28 10 89 73 58 44 31 19 8 94 85 77 70 64 59 55 52 50 49\\r\\n']}, {'input': '97\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 9 24 40 57 75 94 17 38 60 83 10 35 61 88 19 48 78 12 44 77 14 49 85 25 63 5 45 86 31 74 21 66 15 62 13 62 15 66 21 74 31 86 45 5 63 25 85 49 14 77 44 12 78 48 19 88 61 35 10 83 60 38 17 94 75 57 40 24 9 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '98\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 8 23 39 56 74 93 15 36 58 81 7 32 58 85 15 44 74 7 39 72 8 43 79 18 56 95 37 78 22 65 11 56 4 51 1 50 2 53 7 60 16 71 29 86 46 7 67 30 92 57 23 88 56 25 93 64 36 9 81 56 32 9 85 64 44 25 7 88 72 57 43 30 18 7 95 86 78 71 65 60 56 53 51 50\\r\\n']}, {'input': '99\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 7 22 38 55 73 92 13 34 56 79 4 29 55 82 11 40 70 2 34 67 2 37 73 11 49 88 29 70 13 56 1 46 92 40 88 38 88 40 92 46 1 56 13 70 29 88 49 11 73 37 2 67 34 2 70 40 11 82 55 29 4 79 56 34 13 92 73 55 38 22 7 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '100\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 6 21 37 54 72 91 11 32 54 77 1 26 52 79 7 36 66 97 29 62 96 31 67 4 42 81 21 62 4 47 91 36 82 29 77 26 76 27 79 32 86 41 97 54 12 71 31 92 54 17 81 46 12 79 47 16 86 57 29 2 76 51 27 4 82 61 41 22 4 87 71 56 42 29 17 6 96 87 79 72 66 61 57 54 52 51\\r\\n']}]","id":150} {"description":"Bob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting points on a coordinate plane. Now he's drawing camels with t humps, representing them as polylines in the plane. Each polyline consists of n vertices with coordinates (x1,y1), (x2,y2), ..., (xn,yn). The first vertex has a coordinate x1=1, the second \u2014 x2=2, etc. Coordinates yi might be any, but should satisfy the following conditions: there should be t humps precisely, i.e. such indexes j (2\u2264j\u2264n-1), so that yj-1yj+1, there should be precisely t-1 such indexes j (2\u2264j\u2264n-1), so that yj-1>yj pc_i-1\r\n # dp[l][g][pg = 1][pc] = dp[l - 1][g - 1][pg = 0][pc]\r\n # dp[l][g][pg = 0][pc] = dp[l - 1][g][pg = 0][pc]\r\n\r\n # answer in dp[n][t][0][1 <= i <= 4]\r\n\r\n dp = [[[[0 for l in range(4)] for k in range(2)] for j in range(t + 2)] for i in range(n)]\r\n\r\n for i in range(4):\r\n dp[0][0][1][i] = 1\r\n\r\n for l in range(1, n):\r\n for g in range(t + 2):\r\n for curr_last in range(4):\r\n for prev_last in range(4):\r\n if curr_last == prev_last:\r\n continue\r\n if curr_last < prev_last:\r\n dp[l][g][0][curr_last] += dp[l - 1][g][0][prev_last]\r\n if g > 0 and l > 1:\r\n dp[l][g][0][curr_last] += dp[l - 1][g - 1][1][prev_last]\r\n else:\r\n dp[l][g][1][curr_last] += dp[l - 1][g][0][prev_last] + dp[l - 1][g][1][prev_last]\r\n\r\n print(sum([dp[n - 1][t][0][i] for i in range(4)]))\r\n\r\n\r\n\r\nif __name__ == '__main__':\r\n multi_test = 0\r\n\r\n if multi_test == 1:\r\n t = int(sys.stdin.readline())\r\n for _ in range(t):\r\n solve()\r\n else:\r\n solve()\r\n","testcases":"[{'input': ['6 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['4 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 1\\r\\n'], 'output': ['14\\r\\n']}, {'input': ['3 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4 1\\r\\n'], 'output': ['22\\r\\n']}, {'input': ['4 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['4 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 1\\r\\n'], 'output': ['16\\r\\n']}, {'input': ['5 2\\r\\n'], 'output': ['70\\r\\n']}, {'input': ['5 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 1\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['6 2\\r\\n'], 'output': ['232\\r\\n']}, {'input': ['6 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 4\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['19 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['19 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['19 3\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['19 4\\r\\n'], 'output': ['32632\\r\\n']}, {'input': ['19 5\\r\\n'], 'output': ['4594423\\r\\n']}, {'input': ['19 6\\r\\n'], 'output': ['69183464\\r\\n']}, {'input': ['19 7\\r\\n'], 'output': ['197939352\\r\\n']}, {'input': ['19 8\\r\\n'], 'output': ['109824208\\r\\n']}, {'input': ['19 9\\r\\n'], 'output': ['5846414\\r\\n']}, {'input': ['19 10\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 4\\r\\n'], 'output': ['12628\\r\\n']}, {'input': ['20 5\\r\\n'], 'output': ['3715462\\r\\n']}, {'input': ['20 6\\r\\n'], 'output': ['96046590\\r\\n']}, {'input': ['20 7\\r\\n'], 'output': ['468541040\\r\\n']}, {'input': ['20 8\\r\\n'], 'output': ['503245466\\r\\n']}, {'input': ['20 9\\r\\n'], 'output': ['90700276\\r\\n']}, {'input': ['20 10\\r\\n'], 'output': ['0\\r\\n']}]","id":151} {"description":"Nick is attracted by everything unconventional. He doesn't like decimal number system any more, and he decided to study other number systems. A number system with base b caught his attention. Before he starts studying it, he wants to write in his notepad all the numbers of length n without leading zeros in this number system. Each page in Nick's notepad has enough space for c numbers exactly. Nick writes every suitable number only once, starting with the first clean page and leaving no clean spaces. Nick never writes number 0 as he has unpleasant memories about zero divide.Would you help Nick find out how many numbers will be written on the last page.","input_specification":"The only input line contains three space-separated integers b, n and c (2\u2264b<10^10^6, 1\u2264n<10^10^6, 1\u2264c\u226410^9). You may consider that Nick has infinite patience, endless amount of paper and representations of digits as characters. The numbers doesn't contain leading zeros.\n","output_specification":"In the only line output the amount of numbers written on the same page as the last number.\n","notes":"In both samples there are exactly 4 numbers of length 3 in binary number system. In the first sample Nick writes 3 numbers on the first page and 1 on the second page. In the second sample all the 4 numbers can be written on the first page.\n","sample_inputs":["2 3 3\n","2 3 4\n"],"sample_outputs":["1","4"],"src_uid":"17_D","lang_cluster":"Python","difficulty":2400,"human_solution":"'''\r\nHala Madrid!\r\nhttps:\/\/www.zhihu.com\/people\/li-dong-hao-78-74\r\n'''\r\n\r\nimport sys\r\nimport os\r\nfrom io import BytesIO, IOBase\r\nBUFSIZE = 8192\r\nclass FastIO(IOBase):\r\n newlines = 0\r\n def __init__(self, file):\r\n self._fd = file.fileno()\r\n self.buffer = BytesIO()\r\n self.writable = \"x\" in file.mode or \"r\" not in file.mode\r\n self.write = self.buffer.write if self.writable else None\r\n def read(self):\r\n while True:\r\n b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\r\n if not b:\r\n break\r\n ptr = self.buffer.tell()\r\n self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n self.newlines = 0\r\n return self.buffer.read()\r\n def readline(self):\r\n while self.newlines == 0:\r\n b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\r\n self.newlines = b.count(b\"\\n\") + (not b)\r\n ptr = self.buffer.tell()\r\n self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)\r\n self.newlines -= 1\r\n return self.buffer.readline()\r\n def flush(self):\r\n if self.writable:\r\n os.write(self._fd, self.buffer.getvalue())\r\n self.buffer.truncate(0), self.buffer.seek(0)\r\nclass IOWrapper(IOBase):\r\n def __init__(self, file):\r\n self.buffer = FastIO(file)\r\n self.flush = self.buffer.flush\r\n self.writable = self.buffer.writable\r\n self.write = lambda s: self.buffer.write(s.encode(\"ascii\"))\r\n self.read = lambda: self.buffer.read().decode(\"ascii\")\r\n self.readline = lambda: self.buffer.readline().decode(\"ascii\")\r\nsys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)\r\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\r\n\r\ndef I():\r\n return input()\r\ndef II():\r\n return int(input())\r\ndef MI():\r\n return map(int, input().split())\r\ndef LI():\r\n return list(input().split())\r\ndef LII():\r\n return list(map(int, input().split()))\r\ndef GMI():\r\n return map(lambda x: int(x) - 1, input().split())\r\n\r\n#------------------------------FastIO---------------------------------\r\n\r\nfrom bisect import *\r\nfrom heapq import *\r\nfrom collections import *\r\nfrom functools import *\r\nfrom itertools import *\r\nfrom time import *\r\nfrom random import *\r\nfrom math import log, gcd, sqrt, ceil\r\n\r\n'''\r\n\u00e6\u0089\u008b\u00e5\u0086\u0099\u00e6\u00a0\u0088\u00e9\u0098\u00b2\u00e6\u00ad\u00a2recursion limit\r\n\u00e6\u00b3\u00a8\u00e6\u0084\u008f\u00e8\u00a6\u0081\u00e7\u0094\u00a8yield \u00e4\u00b8\u008d\u00e8\u00a6\u0081\u00e7\u0094\u00a8return\r\n'''\r\nfrom types import GeneratorType\r\ndef bootstrap(f, stack=[]):\r\n def wrappedfunc(*args, **kwargs):\r\n if stack:\r\n return f(*args, **kwargs)\r\n else:\r\n to = f(*args, **kwargs)\r\n while True:\r\n if type(to) is GeneratorType:\r\n stack.append(to)\r\n to = next(to)\r\n else:\r\n stack.pop()\r\n if not stack:\r\n break\r\n to = stack[-1].send(to)\r\n return to\r\n return wrappedfunc\r\n\r\n'''\r\nmax(***), mp\u00e5\u008f\u00af\u00e8\u0083\u00bd\u00e4\u00b8\u00ba\u00e7\u00a9\u00ba -> error\r\n'''\r\nclass Prime:\r\n def prime_sieve(self, n):\r\n \"\"\"returns a sieve of primes >= 5 and < n\"\"\"\r\n flag = n % 6 == 2\r\n sieve = bytearray((n \/\/ 3 + flag >> 3) + 1)\r\n for i in range(1, int(n**0.5) \/\/ 3 + 1):\r\n if not (sieve[i >> 3] >> (i & 7)) & 1:\r\n k = (3 * i + 1) | 1\r\n for j in range(k * k \/\/ 3, n \/\/ 3 + flag, 2 * k):\r\n sieve[j >> 3] |= 1 << (j & 7)\r\n for j in range(k * (k - 2 * (i & 1) + 4) \/\/ 3, n \/\/ 3 + flag, 2 * k):\r\n sieve[j >> 3] |= 1 << (j & 7)\r\n return sieve\r\n\r\n def prime_list(self, n):\r\n \"\"\"returns a list of primes <= n\"\"\"\r\n res = []\r\n if n > 1:\r\n res.append(2)\r\n if n > 2:\r\n res.append(3)\r\n if n > 4:\r\n sieve = self.prime_sieve(n + 1)\r\n res.extend(3 * i + 1 | 1 for i in range(1, (n + 1) \/\/ 3 + (n % 6 == 1)) if not (sieve[i >> 3] >> (i & 7)) & 1)\r\n return res\r\n \r\n def __init__(self, n) -> None:\r\n self.primes = self.prime_list(n)\r\n \r\n def dissolve(self, num):\r\n '''prime factor decomposition of num'''\r\n lst = []\r\n idx = -1\r\n for prime in self.primes:\r\n if prime > num:\r\n break\r\n\r\n if num % prime == 0:\r\n lst.append([prime, 0])\r\n idx += 1\r\n \r\n while num % prime == 0:\r\n lst[idx][1] += 1\r\n num \/\/= prime\r\n \r\n if num != 1:\r\n lst.append([num, 1])\r\n \r\n return lst\r\n \r\n #\u00e6\u00b1\u0082\u00e5\u00be\u0088\u00e5\u00a4\u00a7\u00e7\u009a\u0084\u00e6\u0095\u00b0\u00e5\u0080\u00bc\u00e7\u009a\u0084\u00e5\u008d\u0095\u00e7\u0082\u00b9\u00e7\u009a\u0084phi\u00e7\u0094\u00a8\u00ef\u00bc\u008c\u00e8\u00bf\u009e\u00e7\u00bb\u00ad\u00e5\u008c\u00ba\u00e9\u0097\u00b4\u00e8\u00bf\u0098\u00e6\u0098\u00af\u00e7\u0094\u00a8\u00e5\u0085\u00b6\u00e4\u00bb\u0096\u00e7\u009a\u0084\u00e6\u0096\u00b9\u00e6\u00b3\u0095#\r\n def get_phi(self, num):\r\n res = num\r\n for a, b in self.dissolve(num):\r\n res -= res \/\/ a\r\n return res \r\n\r\npri = Prime(10 ** 5 + 10)\r\n\r\ndef solve():\r\n #\u00e6\u00ac\u00a7\u00e6\u008b\u0089\u00e9\u0099\u008d\u00e5\u00b9\u0082#\r\n b, n, c = LI()\r\n c = int(c)\r\n pw = [1 for _ in range(10 ** 6 + 10)]\r\n phi = pri.get_phi(c)\r\n #print('phi', phi)\r\n pw_phi = [1 for _ in range(10 ** 6 + 10)]\r\n for i in range(1, 10 ** 6 + 10):\r\n pw[i] = pw[i - 1] * 10 % c\r\n pw_phi[i] = pw_phi[i - 1] * 10 % phi\r\n \r\n #(b ^ n - b ^ (n - 1)) % c = (b - 1) * (b ^ (n - 1)) % c#\r\n\r\n #\u00e8\u00ae\u00a1\u00e7\u00ae\u0097b % c#\r\n b2 = 0\r\n lb = len(b)\r\n idx = 0\r\n for i in range(lb - 1, -1, -1):\r\n b2 += int(b[i]) * pw[idx]\r\n idx += 1\r\n b2 %= c\r\n #print('b2', b2)\r\n\r\n #\u00e5\u0088\u00a4\u00e6\u0096\u00adphi\u00e4\u00b8\u008en-1\u00e7\u009a\u0084\u00e5\u0085\u00b3\u00e7\u00b3\u00bb#\r\n sphi = str(phi)\r\n if len(n) > len(sphi) + 1:\r\n flag = True\r\n elif len(n) < len(sphi):\r\n flag = False\r\n else:\r\n if int(n) - 1 >= phi:\r\n flag = True\r\n else:\r\n flag = False\r\n\r\n \r\n #\u00e8\u00ae\u00a1\u00e7\u00ae\u0097n % phi(c)#\r\n n2 = 0\r\n ln = len(n)\r\n idx = 0\r\n for i in range(ln - 1, -1, -1):\r\n n2 += int(n[i]) * pw_phi[idx]\r\n idx += 1\r\n n2 %= phi\r\n #print('n2', n2)\r\n \r\n res = (b2 - 1) % c\r\n n2 = (n2 - 1) % phi\r\n #print('res n2', res, n2)\r\n if not flag:\r\n res *= pow(b2, n2, c)\r\n else:\r\n res *= pow(b2, n2 + phi, c)\r\n #print('pow', pow(b2, n2 + phi, c))\r\n res %= c\r\n if res:\r\n print(res)\r\n else:\r\n print(c)\r\n\r\nfor _ in range(1):solve()","testcases":"[{'input': ['2 3 3\\r\\n'], 'output': ['1']}, {'input': ['2 3 4\\r\\n'], 'output': ['4']}, {'input': ['9 1 79\\r\\n'], 'output': ['8']}, {'input': ['9 1 345\\r\\n'], 'output': ['8']}, {'input': ['9 9 999982045\\r\\n'], 'output': ['344373768']}, {'input': ['4 42 44\\r\\n'], 'output': ['12']}, {'input': ['6 43 659\\r\\n'], 'output': ['365']}, {'input': ['8 54 999992388\\r\\n'], 'output': ['741886148']}, {'input': ['861 11 17\\r\\n'], 'output': ['14']}, {'input': ['89 34 119\\r\\n'], 'output': ['80']}, {'input': ['84 67 999993310\\r\\n'], 'output': ['829809148']}, {'input': ['9219 537 98\\r\\n'], 'output': ['98']}, {'input': ['763 582 510\\r\\n'], 'output': ['96']}, {'input': ['6355 60160 999982994\\r\\n'], 'output': ['904671182']}, {'input': ['396882961 9936448 752\\r\\n'], 'output': ['528']}, {'input': ['394292559875270 34297300532732 28\\r\\n'], 'output': ['28']}, {'input': ['8523703220091 953421047275844 163\\r\\n'], 'output': ['30']}, {'input': ['713030357739784847 61197710123555584 999992531\\r\\n'], 'output': ['207016405']}, {'input': ['75903940600326238527 492179977057716178 954\\r\\n'], 'output': ['450']}, {'input': ['8085477143815539692925721 57241684823084777591460 968\\r\\n'], 'output': ['304']}, {'input': ['67609394386924890416446 78162115935271414671181267 999987217\\r\\n'], 'output': ['926946271']}, {'input': ['3351262437484130462277638791970372162118802730187825044167229944871677684706592699530322737272222086076517455404652584348 147310576952932829345029460612849431175622785231399764423717734155248977073541821053441627535488066058597900989095431439 999998948\\r\\n'], 'output': ['930694076']}, {'input': ['61063034544457239668509642598956869508193198481915116469015956878854905975766584002919896320353661294612971855029955483257741525207429239630069409321331850413146512850720681578339422084340720535114848966742045420860633093949996367883 965415513080902927493169838825380834798188421277961155726185690857844534367611949025561401481462737822765050755128163519122172969767981851117402342816829930821131453945898813517587656899608854645391515043085723743408226445117376493281975889755859761322184701256801 999998603\\r\\n'], 'output': ['60342257']}, {'input': ['9 1000000000000000000000000000000000000000000000000000000 345\\r\\n'], 'output': ['192']}, {'input': ['8053063680000000000000000000000000002 268435456000000000000005 805306368\\r\\n'], 'output': ['268435456']}, {'input': ['8053063680000000000000000000000000002 2684354560000000000000025 805306368\\r\\n'], 'output': ['268435456']}, {'input': ['8053063680000000000000000000000000002 2684354560000000000000026 805306368\\r\\n'], 'output': ['536870912']}, {'input': ['8053063680000000000000000000000000002 2684354560000000000000027 805306368\\r\\n'], 'output': ['268435456']}, {'input': ['8053063680000000000000000000000000002 2684354560000000000000028 805306368\\r\\n'], 'output': ['536870912']}, {'input': ['8053063680000000000000000000000000002 2684354560000000000000029 805306368\\r\\n'], 'output': ['268435456']}, {'input': ['8053063680000000000000000000000000002 2684354560000000000000030 805306368\\r\\n'], 'output': ['536870912']}, {'input': ['8053063680000000000000000000000000002 2684354560000000000000031 805306368\\r\\n'], 'output': ['268435456']}, {'input': ['2271048430505293080737093330373572593316324321603522463486966273671353266974713306925326907468317965879775893196923719457524955744 8990615363653447573832140957083458603886706189959668013719622351914533208654357508127820477597609318856255372184258450991108060161 53727872\\r\\n'], 'output': ['26470400']}, {'input': ['244741007655429712 1 297825872\\r\\n'], 'output': ['297825871']}]","id":152} {"description":"Jabber ID on the national Berland service \u00abBabber\u00bb has a form @[\/resource], where \u2014 is a sequence of Latin letters (lowercase or uppercase), digits or underscores characters \u00ab_\u00bb, the length of is between 1 and 16, inclusive. \u2014 is a sequence of word separated by periods (characters \u00ab.\u00bb), where each word should contain only characters allowed for , the length of each word is between 1 and 16, inclusive. The length of is between 1 and 32, inclusive. \u2014 is a sequence of Latin letters (lowercase or uppercase), digits or underscores characters \u00ab_\u00bb, the length of is between 1 and 16, inclusive. The content of square brackets is optional \u2014 it can be present or can be absent.There are the samples of correct Jabber IDs: [email\u00a0protected], [email\u00a0protected]\/contest.Your task is to write program which checks if given string is a correct Jabber ID.","input_specification":"The input contains of a single line. The line has the length between 1 and 100 characters, inclusive. Each characters has ASCII-code between 33 and 127, inclusive.\n","output_specification":"Print YES or NO.\n","notes":null,"sample_inputs":["[email\u00a0protected]\n","[email\u00a0protected]\/contest.icpc\/12\n"],"sample_outputs":["YES\n","NO\n"],"src_uid":"21_A","lang_cluster":"Python","difficulty":1900,"human_solution":"def isvalid(jabberid):\r\n splitted=jabberid.split('@');\r\n if len(splitted)!=2:\r\n return False;\r\n\r\n username=splitted[0];\r\n for c in username:\r\n if not(c.isalpha() or c.isdigit() or c=='_'):\r\n return False;\r\n if len(username)<1 or len(username)>16:\r\n return False;\r\n splitted=splitted[1].split('\/');\r\n if len(splitted)>2:\r\n return False;\r\n\r\n hostname=splitted[0];\r\n resource='noresource';\r\n if len(splitted)>1:\r\n resource=splitted[1];\r\n\r\n if len(hostname)<1 or len(hostname)>32:\r\n return False;\r\n words=hostname.split('.');\r\n for word in words:\r\n if len(word)<1 or len(word)>16:\r\n return False;\r\n for c in word:\r\n if not(c.isalpha() or c.isdigit() or c=='_'):\r\n return False;\r\n\r\n if len(resource)<1 or len(resource)>16:\r\n return False;\r\n for c in resource:\r\n if not(c.isalpha() or c.isdigit() or c=='_'):\r\n return False;\r\n\r\n return True;\r\n \r\n\r\njabberid=input();\r\nif isvalid(jabberid):\r\n print('YES');\r\nelse:\r\n print('NO');\r\n","testcases":"[{'input': ['mike@codeforces.com\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['john.smith@codeforces.ru\/contest.icpc\/12\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['test@test.ri\/abacaba\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['@ops\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['this-is-the-test\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['mike@codeforces.commike@codeforces.com\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['oooop\/oooop\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['w@S8\/XU.5._R7fHq.@..\/e.WP!54Ey1L\\x7f.9jv\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['lNC9D1L5U@.L!_!CcAOEEx.0z.aiW\/S430sbQT\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['@\/YTd.K1@lD\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Fyi!d1l@.OesGopTnRn.81xdSb8q\\x7f.\/MzuI\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['_TlPy65\\x7fw\/@.Vl@.8k\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['xpS@._s8.e0l\\x7fJci\/.LdiT\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['lGwo\\x7f8.D2@.3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Ccz9T5rKZQuEerGo@6l.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Y@5nh@8.9P.Bx5AaY.1g.Tc_MK7.g_..0.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Q2\/6y!SP9s\\x7fG@7zIGr.Du_nR8.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['eWfLL@gW!BEJUxF\\x7fh@dghf.d4.FiYp\/2.Pr7a\/5O6zXdAkikjCEDrb\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['8oI\/\\x7fa@Q\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['J@Y9Gz550l@\\x7fPqVZdQ!u\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['VTE6aTTta@DHe4xeG@6.c2R.J.O7sndWEEW.9j@.l..3Bs\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['aeo2XkK@UX.nQJN!Tg..wGN5YOi68U.oP2Yl3\/\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['m13zREg8LbPr@T2.Z9@g.9u.v.A..XNH\/1\/tloIceXydZf3\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4@@..f3ZT.\/oUGZ@\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['G.rVAxwDx@a.PVSe!KtpX4tzs\/0yQGzZCPJPJoda\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['SV9T5RR425Sl0b@kzj.XT.PFWc..ho\/VE7gjf\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['bgko@1..\/xwSj_\\x7fJ\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['n5ymLC.bE@ukio.im2..\/.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['zr.KB_6ZMSwI2GA5@R\/4iP1ZKHpszW!YN\/\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['@alK@pR\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['al_Y2I4IKp@A_N.\\x7fruCw0VL\/hRzJtx.S7sp\/r!c.n9ffh\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['C1rE26_rTAVzLm@6@X5OGX.ibJ9.\/kkBEVlcU\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['feGSXP@eyUfr\\x7f8.x4Re.JL.6B.r\/fX_\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Ht15T@50eo.E@.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['k9MITs_Ar.JL2RRs4@VRq.wCuJ.6..amF.fE4.5I.6fJ7gz7\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Mi\\x7fWPE8@fc.\/IViqq4T4PSUuMdhH\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['pxSCmv!NbMvz2@pTQ.t!.Ntz\/QEh_sl\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['s@mH@RO\\x7f_\/iWD\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['UP51i49wX@pvx@2LWm8w\/G4M3J.\/9L6Szy\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['xC_5Vx8NgF..\\x7fln@X1.drRTX..1vx.Xb3of@\/PQYPeq@_y8!h_iF\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['qG3@LKp\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['flTq1knyb@2!Mtfss\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['\/pqi7WXQPJFM4q1@hxUyUy\\x7f\/_pWo0n\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['zXme@.Dq.TWBs.fB.M\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['o3EaAnc3K6@h\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['G\/AZdVMTzRLV4Ucm@eQ!..pq!..tRTi5.Ejkqa\/HGpFYk\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['.c_V@L.1v!AFAEk7glM\\x7fq.ag8Sy8@0.Qm\/OLKoJpZlac\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['WKxNIM79u\\x7f@I.RM\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk\/M_jTHS_6!\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['pbRIiuA@KZ2hVed2fMikA.@ebd.tE2Y\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['OlS_OwxYhH@im.0A7o\/juNlxB\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['xkjHHDRBEFwgNP@G9TGStEs2Lu.BJge3EBXw3c9EfE\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['bK@8X7tQO.pXBHJpDewD\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['kKUXy6@0WefbXz39ywP.Q3r7uF\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['SllbRLdZ6@.T.E3x.BE2nIv.5db_.38.\/zgVGNjpldr\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['4lBJkY8c097oa@ZYmVbtiyyYN.gbj\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['F@JX4.SI1\/0EY3XmYatfY\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['oLo01@B77Pu.9R.vtAZG0.HQSunv0J.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['xLEctap0T@22U9W_fA\/7iQeJGFu1lSgMZ\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['WYh@yUWfOQiF.gOK9k8aEa\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['BPxNVANhtEh@Oh_go.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['mGIY@cHRNC8GlJ\/2pcl3LYxpi3PaKGs\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['x6yfn7BGwqWd@.N\/UXC\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['cUIr@cP.eGQC2xJXvI1X7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['MLZ6e1vgZ4hOI@ktWk.Ro.o6C4\/i8cnKHT\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['XCJIa@jFaP.Eu28YaoT9Z.Epk.Z\/4TBzLWf724zE1r\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Cz1U1xjg6iW0U@.97HoVA.YG.Qd.eI.DCXxtibi6HG.GV\/0sN\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['nrKbWV@P0irxQoRxDsNvG\/69WxCwCsfB\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['yI1nRv3FbuhgaI@.Y9vKe.8oc.BLi.6JfYT\/tT5d36\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR\/_97Ltj3\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Uu538LDu9Bye@Gu0W0P5a.b9zA9nSaNhzB_TQ2.z\/qfi5CZrH\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['bdHl525me@XzR_iO23v.YFXbnHUybbgw.i\/WVEhm\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['NQsZ0K@eE8VMB.w2nYtKImB.4nUF\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['186@E.MmBaKLj.WYpt4wPZkzv93\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['hmhYxkGtWYRJFtBU@Drg3L7WKujE.lU61Ljqxv.\/FJ4X\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['t1RIUz9l3FA15@tOL9.rv.NjhouD.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['_I4ytjyccT@q.WIc.Cqn\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['LwHHRYq@whOoq.e9b6i0xnoWBl7z.SGJiJe\/iUij1x7\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['Yesx@9_KiJq2cBI6.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['Zu5VFUtSbIw@ner5e\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['test@test.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['test@.test\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['est.@test\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['test@test.ru\/\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['asd@asd@\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['@\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['\/\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['.\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['mike@\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['@mike\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['@mail.ru\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['test.me\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['$@ru\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['testme@o.o.o.o.o\/ooooo\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['oooop\/oooop\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['mail.ru\/a\\r\\n'], 'output': ['NO\\r\\n']}, {'input': ['mike@mail.ru\/aaa\\r\\n'], 'output': ['YES\\r\\n']}, {'input': ['mike@mike.mike\\r\\n'], 'output': ['YES\\r\\n']}]","id":153} {"description":"Once Bob took a paper stripe of n squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly negative. He became interested in how many ways exist to cut this stripe into three pieces so that the sum of numbers from each piece is equal to the sum of numbers from any other piece, and each piece contains positive integer amount of squares. Would you help Bob solve this problem?","input_specification":"The first input line contains integer n (1\u2264n\u226410^5) \u2014 amount of squares in the stripe. The second line contains n space-separated numbers \u2014 they are the numbers written in the squares of the stripe. These numbers are integer and do not exceed 10000 in absolute value.\n","output_specification":"Output the amount of ways to cut the stripe into three non-empty pieces so that the sum of numbers from each piece is equal to the sum of numbers from any other piece. Don't forget that it's allowed to cut the stripe along the squares' borders only.\n","notes":null,"sample_inputs":["4\n1 2 3 3\n","5\n1 2 3 4 5\n"],"sample_outputs":["1\n","0\n"],"src_uid":"21_C","lang_cluster":"Python","difficulty":2000,"human_solution":"import sys\r\n\r\nSEPARATOR = \"\\n\"\r\nUNICODE = \"utf-8\"\r\n\r\ndef count_stripes(arr: list) -> int:\r\n arr_sum = sum(arr)\r\n if arr_sum % 3 != 0:\r\n return 0\r\n length = len(arr)\r\n counter = 0\r\n pref = 0\r\n stipe_arr = [0] * (length + 1)\r\n for i in range(1, length+1):\r\n pref += arr[i-1]\r\n stipe_arr[i] = stipe_arr[i-1] + (pref*3 == arr_sum)\r\n # print(stipe_arr)\r\n suf = 0\r\n for i in range(length-1, 1, -1):\r\n suf += arr[i]\r\n if suf*3 == arr_sum:\r\n if arr_sum == 0:\r\n counter += stipe_arr[i-1]\r\n else:\r\n counter += stipe_arr[i]\r\n return counter\r\n\r\n\r\nlines = sys.stdin.buffer.readlines()\r\nprint(count_stripes([int(n) for n in lines[1].decode(UNICODE).strip().split()]))","testcases":"[{'input': ['1\\r\\n-3\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n0 0\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3\\r\\n0 0 0\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4\\r\\n-2 3 3 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5\\r\\n-6 3 -1 2 -7\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6\\r\\n2 3 -3 0 -3 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7\\r\\n-1 1 -3 4 3 0 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['8\\r\\n2 0 0 2 -1 3 4 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9\\r\\n-5 -2 1 1 5 0 -4 4 0\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['10\\r\\n-1 5 2 3 1 5 0 2 2 5\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100\\r\\n3 0 -5 2 -3 -1 -1 0 -2 -5 -4 2 1 2 -2 -1 -1 -4 3 -1 -3 -1 5 0 -4 -4 -1 0 -2 -2 0 1 -1 -2 -1 -5 -4 -2 3 1 -3 0 -1 1 0 -1 2 0 -2 -1 -3 1 -2 2 3 2 -3 -5 2 2 -2 -2 1 2 -2 -1 3 0 -4 7 -2 2 1 4 -9 -1 -2 -1 0 -1 0 -2 -2 -1 1 1 -4 2 -3 -3 7 1 1 -3 -7 0 -2 0 5 -2\\r\\n'], 'output': ['5\\r\\n']}]","id":154} {"description":"Iahubina is tired of so many complicated languages, so she decided to invent a new, simple language. She already made a dictionary consisting of n 3-words. A 3-word is a sequence of exactly 3 lowercase letters of the first 24 letters of the English alphabet (a to x). She decided that some of the letters are vowels, and all the others are consonants. The whole language is based on a simple rule: any word that contains at least one vowel is correct.Iahubina forgot which letters are the vowels, and wants to find some possible correct sets of vowels. She asks Iahub questions. In each question, she will give Iahub a set of letters considered vowels (in this question). For each question she wants to know how many words of the dictionary are correct, considering the given set of vowels.Iahubina wants to know the xor of the squared answers to all the possible questions. There are 2^24 different questions, they are all subsets of the set of the first 24 letters of the English alphabet. Help Iahub find that number.","input_specification":"The first line contains one integer, n (1\u2264n\u226410^4). Each of the next n lines contains a 3-word consisting of 3 lowercase letters. There will be no two identical 3-words.\n","output_specification":"Print one number, the xor of the squared answers to the queries.\n","notes":null,"sample_inputs":["5\nabc\naaa\nada\nbcd\ndef\n"],"sample_outputs":["0\n"],"src_uid":"383_E","lang_cluster":"Python","difficulty":2700,"human_solution":"import sys\r\nreadline=sys.stdin.readline\r\n\r\nN=int(readline())\r\ndp=[0]*(1<<24)\r\ndp[-1]=N\r\nfor _ in range(N):\r\n bit=(1<<24)-1\r\n for a in readline().rstrip():\r\n a=ord(a)-97\r\n if bit&1<= x:\r\n inc.pop()\r\n inc.append(j)\r\n \r\n while dec and h[dec[-1]] <= x:\r\n dec.pop()\r\n dec.append(j)\r\n \r\n while h[dec[0]] - h[inc[0]] > k:\r\n if dec[0] < inc[0]:\r\n i = max(i, dec.popleft() + 1)\r\n else:\r\n i = max(i, inc.popleft() + 1)\r\n \r\n if j - i + 1 > mx:\r\n res = []\r\n mx = j - i + 1\r\n \r\n if j - i + 1 == mx:\r\n res.append((i + 1, j + 1))\r\n\r\nprint(mx, len(res))\r\nfor i, j in res:\r\n print(i, j)\r\n \r\n ","testcases":"[{'input': ['3 3\\r\\n14 12 10\\r\\n'], 'output': ['2 2\\r\\n1 2\\r\\n2 3\\r\\n']}, {'input': ['2 0\\r\\n10 10\\r\\n'], 'output': ['2 1\\r\\n1 2\\r\\n']}, {'input': ['4 5\\r\\n8 19 10 13\\r\\n'], 'output': ['2 1\\r\\n3 4\\r\\n']}, {'input': ['1 1\\r\\n1\\r\\n'], 'output': ['1 1\\r\\n1 1\\r\\n']}, {'input': ['2 10\\r\\n35 45\\r\\n'], 'output': ['2 1\\r\\n1 2\\r\\n']}, {'input': ['4 8\\r\\n89 33 54 75\\r\\n'], 'output': ['1 4\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n']}, {'input': ['5 1\\r\\n9 6 8 7 5\\r\\n'], 'output': ['2 1\\r\\n3 4\\r\\n']}, {'input': ['3 3\\r\\n3 8 6\\r\\n'], 'output': ['2 1\\r\\n2 3\\r\\n']}, {'input': ['4 1000000\\r\\n100001 1 200001 300001\\r\\n'], 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': ['4 1000\\r\\n11497 9999 10730 12280\\r\\n'], 'output': ['2 1\\r\\n2 3\\r\\n']}, {'input': ['3 0\\r\\n1000000 1000000 1000000\\r\\n'], 'output': ['3 1\\r\\n1 3\\r\\n']}, {'input': ['4 50\\r\\n165 182 157 132\\r\\n'], 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': ['5 173\\r\\n350 250 200 300 400\\r\\n'], 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': ['4 0\\r\\n1 1 1 1\\r\\n'], 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': ['2 1000000\\r\\n1 1000000\\r\\n'], 'output': ['2 1\\r\\n1 2\\r\\n']}, {'input': ['7 14\\r\\n28 28 29 35 25 29 28\\r\\n'], 'output': ['7 1\\r\\n1 7\\r\\n']}, {'input': ['10 163\\r\\n7541 2535 5883 5775 2821 5962 4489 5548 2852 4595\\r\\n'], 'output': ['2 1\\r\\n3 4\\r\\n']}, {'input': ['15 793\\r\\n98580 27440 3719 73977 34819 64092 89939 75329 72884 66502 17464 73662 6666 47984 45348\\r\\n'], 'output': ['1 15\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n5 5\\r\\n6 6\\r\\n7 7\\r\\n8 8\\r\\n9 9\\r\\n10 10\\r\\n11 11\\r\\n12 12\\r\\n13 13\\r\\n14 14\\r\\n15 15\\r\\n']}, {'input': ['28 543\\r\\n1921 1700 1363 2580 2693 3144 2269 908 3863 3750 2151 3039 1581 3395 1133 1804 1464 2040 2372 2475 1240 800 3521 3270 2815 1026 3625 2930\\r\\n'], 'output': ['3 1\\r\\n18 20\\r\\n']}, {'input': ['55 1000\\r\\n2612 1306 4300 1790 3173 9493 7209 7763 8563 4534 7466 1281 4483 6863 3787 7292 3957 8775 7221 4016 5743 6556 2070 2119 4795 9094 1913 2077 8786 4520 1865 2357 7871 3288 8231 5808 9383 9820 9974 3056 5343 2169 5177 6299 5805 8132 9315 6747 5226 3531 1206 4073 8290 1423 6720\\r\\n'], 'output': ['3 1\\r\\n37 39\\r\\n']}]","id":156} {"description":"All of us love treasures, right? That's why young Vasya is heading for a Treasure Island.Treasure Island may be represented as a rectangular table $$$n \\times m$$$ which is surrounded by the ocean. Let us number rows of the field with consecutive integers from $$$1$$$ to $$$n$$$ from top to bottom and columns with consecutive integers from $$$1$$$ to $$$m$$$ from left to right. Denote the cell in $$$r$$$-th row and $$$c$$$-th column as $$$(r, c)$$$. Some of the island cells contain impassable forests, and some cells are free and passable. Treasure is hidden in cell $$$(n, m)$$$.Vasya got off the ship in cell $$$(1, 1)$$$. Now he wants to reach the treasure. He is hurrying up, so he can move only from cell to the cell in next row (downwards) or next column (rightwards), i.e. from cell $$$(x, y)$$$ he can move only to cells $$$(x+1, y)$$$ and $$$(x, y+1)$$$. Of course Vasya can't move through cells with impassable forests.Evil Witch is aware of Vasya's journey and she is going to prevent him from reaching the treasure. Before Vasya's first move she is able to grow using her evil magic impassable forests in previously free cells. Witch is able to grow a forest in any number of any free cells except cells $$$(1, 1)$$$ where Vasya got off his ship and $$$(n, m)$$$ where the treasure is hidden.Help Evil Witch by finding out the minimum number of cells she has to turn into impassable forests so that Vasya is no longer able to reach the treasure.","input_specification":"First line of input contains two positive integers $$$n$$$, $$$m$$$ ($$$3 \\le n \\cdot m \\le 1\\,000\\,000$$$), sizes of the island.\nFollowing $$$n$$$ lines contains strings $$$s_i$$$ of length $$$m$$$ describing the island, $$$j$$$-th character of string $$$s_i$$$ equals \"#\" if cell $$$(i, j)$$$ contains an impassable forest and \".\" if the cell is free and passable. Let us remind you that Vasya gets of his ship at the cell $$$(1, 1)$$$, i.e. the first cell of the first row, and he wants to reach cell $$$(n, m)$$$, i.e. the last cell of the last row.\nIt's guaranteed, that cells $$$(1, 1)$$$ and $$$(n, m)$$$ are empty.\n","output_specification":"Print the only integer $$$k$$$, which is the minimum number of cells Evil Witch has to turn into impassable forest in order to prevent Vasya from reaching the treasure.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"src_uid":"1214_D","lang_cluster":"Python","difficulty":1900,"human_solution":"import sys\r\nfrom array import array\r\n\r\ninput = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")\r\ninp = lambda dtype: [dtype(x) for x in input().split()]\r\ninp_2d = lambda dtype, n: [dtype(input()) for _ in range(n)]\r\ndebug = lambda *x: print(*x, file=sys.stderr)\r\nceil1 = lambda a, b: (a + b - 1) \/\/ b\r\nout, tests = [], 1\r\n\r\n\r\ndef solve(x, y) -> bool:\r\n passable = 0\r\n while x < n and y > -1:\r\n if passbe[x][y] and passen[x][y]:\r\n passable += 1\r\n\r\n x += 1\r\n y -= 1\r\n\r\n return passable == 1\r\n\r\n\r\nfor _ in range(tests):\r\n n, m = inp(int)\r\n a = [input() for _ in range(n)]\r\n passbe = [array('b', [0] * (m + 1)) for _ in range(n + 1)]\r\n passen = [array('b', [0] * (m + 1)) for _ in range(n + 1)]\r\n passbe[-1][0] = passen[-1][m - 1] = 1\r\n\r\n for i in range(n):\r\n for j in range(m):\r\n passbe[i][j] = (passbe[i - 1][j] or passbe[i][j - 1]) and (a[i][j] != '#')\r\n\r\n for i in range(n - 1, -1, -1):\r\n for j in range(m - 1, -1, -1):\r\n passen[i][j] = (passen[i + 1][j] or passen[i][j + 1]) and (a[i][j] != '#')\r\n\r\n if not passbe[n - 1][m - 1]:\r\n out.append(0)\r\n continue\r\n\r\n ans = 2\r\n for j in range(1, m):\r\n if solve(0, j):\r\n ans = 1\r\n break\r\n\r\n for j in range(1, n - 1):\r\n if solve(j, m - 1):\r\n ans = 1\r\n break\r\n\r\n out.append(ans)\r\nprint('\\n'.join(map(str, out)))\r\n","testcases":"[{'input': ['2 2\\r\\n..\\r\\n..\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['5 1\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1 3\\r\\n.#.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 1\\r\\n.\\r\\n.\\r\\n#\\r\\n.\\r\\n.\\r\\n.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 2\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n#.\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 2\\r\\n..\\r\\n#.\\r\\n..\\r\\n..\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['2 2\\r\\n.#\\r\\n..\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['4 5\\r\\n.####\\r\\n#####\\r\\n#####\\r\\n####.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['5 4\\r\\n.###\\r\\n####\\r\\n####\\r\\n####\\r\\n###.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['3 6\\r\\n.#####\\r\\n######\\r\\n#####.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 3\\r\\n.##\\r\\n###\\r\\n###\\r\\n###\\r\\n###\\r\\n##.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 3\\r\\n.##\\r\\n###\\r\\n.##\\r\\n.##\\r\\n#.#\\r\\n#..\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 3\\r\\n.##\\r\\n###\\r\\n.##\\r\\n..#\\r\\n..#\\r\\n#..\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['6 3\\r\\n.##\\r\\n.##\\r\\n.##\\r\\n..#\\r\\n..#\\r\\n#..\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['10 2\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n..\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['20 1\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n#\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['20 1\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n.\\r\\n'], 'output': ['1\\r\\n']}]","id":157} {"description":"Monocarp has arranged $$$n$$$ colored marbles in a row. The color of the $$$i$$$-th marble is $$$a_i$$$. Monocarp likes ordered things, so he wants to rearrange marbles in such a way that all marbles of the same color form a contiguos segment (and there is only one such segment for each color). In other words, Monocarp wants to rearrange marbles so that, for every color $$$j$$$, if the leftmost marble of color $$$j$$$ is $$$l$$$-th in the row, and the rightmost marble of this color has position $$$r$$$ in the row, then every marble from $$$l$$$ to $$$r$$$ has color $$$j$$$.To achieve his goal, Monocarp can do the following operation any number of times: choose two neighbouring marbles, and swap them.You have to calculate the minimum number of operations Monocarp has to perform to rearrange the marbles. Note that the order of segments of marbles having equal color does not matter, it is only required that, for every color, all the marbles of this color form exactly one contiguous segment.","input_specification":"The first line contains one integer $$$n$$$ $$$(2 \\le n \\le 4 \\cdot 10^5)$$$ \u2014 the number of marbles.\nThe second line contains an integer sequence $$$a_1, a_2, \\dots, a_n$$$ $$$(1 \\le a_i \\le 20)$$$, where $$$a_i$$$ is the color of the $$$i$$$-th marble.\n","output_specification":"Print the minimum number of operations Monocarp has to perform to achieve his goal.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"src_uid":"1215_E","lang_cluster":"Python","difficulty":2200,"human_solution":"from sys import stdin\r\ninput = stdin.readline\r\n\r\ninp = lambda : list(map(int,input().split()))\r\n\r\nN = 20\r\n\r\ndef solve(mask):\r\n\r\n if(mask == (1 << N) - 1):return 0\r\n if(dp[mask] != -1):return dp[mask]\r\n\r\n p = 0\r\n for i in range(N):\r\n if(mask >> i & 1):\r\n p += count[i]\r\n\r\n \r\n ans = float('inf')\r\n for i in range(N):\r\n if(mask >> i & 1):continue\r\n\r\n addval = total[i]\r\n for j in range(N):\r\n if(mask >> j & 1 == 0 and i != j):continue\r\n addval -= val[i][j]\r\n \r\n ans = min(ans , solve(mask | (1 << i)) + addval)\r\n\r\n\r\n dp[mask] = ans\r\n return ans\r\n \r\n\r\ndef answer():\r\n\r\n\r\n global dp , val , total , count\r\n\r\n total = [0 for i in range(N)]\r\n val = [[0 for i in range(N)] for j in range(N)]\r\n count = [0 for i in range(N)]\r\n for i in range(n):\r\n \r\n for j in range(N):\r\n val[a[i]][j] += count[j]\r\n\r\n total[a[i]] += i\r\n count[a[i]] += 1\r\n\r\n dp = [-1 for i in range(1 << N)]\r\n\r\n ans = solve(0)\r\n return ans\r\n \r\nfor T in range(1):\r\n\r\n n = int(input())\r\n a = inp()\r\n\r\n for i in range(n):\r\n a[i] -= 1\r\n\r\n print(answer())\r\n","testcases":"[{'input': ['7\\r\\n3 4 2 3 4 2 2\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['5\\r\\n20 1 14 10 2\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['13\\r\\n5 5 4 4 3 5 7 6 5 4 4 6 5\\r\\n'], 'output': ['21\\r\\n']}, {'input': ['10\\r\\n13 13 13 13 13 13 13 9 9 13\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['100\\r\\n11 16 16 11 16 11 16 16 11 16 16 16 16 16 16 16 16 16 11 16 16 16 16 16 16 11 16 11 16 11 16 16 16 11 5 16 16 11 16 16 16 16 16 11 16 11 5 16 16 16 16 5 16 16 11 11 16 16 5 16 11 11 16 16 16 11 11 16 11 16 16 16 16 16 16 11 11 16 16 5 16 5 20 5 16 16 16 11 16 16 16 16 16 16 11 16 20 11 16 5\\r\\n'], 'output': ['1030\\r\\n']}, {'input': ['10\\r\\n14 14 14 14 14 14 14 14 14 14\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['100\\r\\n1 9 15 1 1 12 1 9 1 15 9 1 9 1 1 1 1 1 15 15 12 1 1 1 1 15 1 15 1 1 1 1 1 12 15 1 15 9 1 1 9 15 1 1 12 15 9 1 15 15 1 1 1 1 15 1 1 1 1 1 1 15 1 15 1 1 9 9 12 1 1 15 1 15 15 15 1 15 9 9 1 15 12 1 12 1 15 1 15 9 15 15 15 15 1 9 1 12 1 1\\r\\n'], 'output': ['1342\\r\\n']}, {'input': ['10\\r\\n6 6 7 7 6 7 6 6 7 17\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['100\\r\\n1 1 3 3 5 14 3 1 1 3 3 3 3 3 14 3 14 3 4 3 3 14 14 14 3 5 14 5 14 3 4 1 14 4 3 3 14 14 1 3 3 14 3 14 3 3 5 5 3 1 3 1 3 3 1 3 1 3 5 14 14 14 5 3 5 3 3 3 3 3 4 14 3 5 3 3 3 3 1 1 4 3 3 5 3 5 3 14 3 14 1 3 3 5 3 5 3 3 14 1\\r\\n'], 'output': ['1482\\r\\n']}, {'input': ['10\\r\\n6 6 4 6 6 6 6 9 4 9\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['100\\r\\n4 7 19 19 16 16 1 1 7 1 19 1 16 19 19 7 1 19 1 19 4 16 7 1 1 16 16 1 1 19 7 7 19 7 1 16 1 4 19 19 16 16 4 4 1 19 4 4 16 4 19 4 4 7 19 4 1 7 1 1 19 7 16 4 1 7 4 7 4 7 19 16 7 4 1 4 1 4 19 7 16 7 19 1 16 1 16 4 1 19 19 7 1 4 19 4 19 4 16 4\\r\\n'], 'output': ['1691\\r\\n']}, {'input': ['10\\r\\n14 12 12 14 14 12 14 12 12 14\\r\\n'], 'output': ['12\\r\\n']}, {'input': ['100\\r\\n5 16 6 5 16 5 5 8 6 8 8 5 16 8 16 8 5 6 16 5 6 5 16 16 5 6 16 5 8 5 5 5 8 5 5 5 6 16 5 5 5 5 8 6 5 16 5 5 16 5 5 5 8 16 5 5 5 8 16 6 16 5 6 16 16 5 5 16 8 5 16 16 5 16 8 5 6 5 5 16 5 16 6 5 8 20 16 8 16 16 20 5 5 16 5 8 16 16 20 16\\r\\n'], 'output': ['1350\\r\\n']}, {'input': ['10\\r\\n18 8 18 18 18 18 18 18 17 8\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['100\\r\\n16 16 8 2 16 8 2 16 1 16 16 16 16 16 16 16 16 8 2 1 16 8 8 16 16 16 8 16 2 16 16 16 16 16 1 1 2 16 2 16 1 8 16 8 16 16 16 8 2 16 8 8 16 16 2 8 1 8 16 1 16 1 16 8 8 16 8 8 16 8 16 8 8 16 16 8 8 16 16 8 8 8 16 8 16 2 16 16 8 8 2 2 16 8 1 2 16 16 16 16\\r\\n'], 'output': ['1373\\r\\n']}, {'input': ['10\\r\\n11 11 11 11 11 3 11 11 3 11\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['100\\r\\n15 2 15 15 15 15 15 15 2 15 2 2 15 15 3 15 2 2 2 15 15 15 15 2 15 15 15 3 2 15 15 2 5 2 15 15 15 15 2 5 3 15 5 2 3 15 15 15 15 15 15 2 15 2 5 15 15 15 15 5 15 2 15 15 15 15 2 2 2 5 2 15 2 15 2 15 15 15 15 2 15 15 2 15 15 2 15 15 15 2 15 2 2 15 15 2 15 15 15 15\\r\\n'], 'output': ['1253\\r\\n']}, {'input': ['2\\r\\n2 1\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['2\\r\\n13 13\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['9\\r\\n1 3 4 1 1 2 3 4 3\\r\\n'], 'output': ['9\\r\\n']}, {'input': ['26\\r\\n1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 2 2 1 1 1 1 2 2 2 2\\r\\n'], 'output': ['86\\r\\n']}, {'input': ['8\\r\\n1 2 2 3 1 2 1 2\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['6\\r\\n1 2 3 1 1 2\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['7\\r\\n1 2 2 3 1 1 2\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['6\\r\\n3 1 2 3 3 1\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['9\\r\\n1 2 3 4 5 6 7 8 9\\r\\n'], 'output': ['0\\r\\n']}, {'input': ['7\\r\\n2 1 1 3 2 2 1\\r\\n'], 'output': ['7\\r\\n']}]","id":158} {"description":"The only difference between the easy and the hard versions is the maximum value of $$$k$$$.You are given an infinite sequence of form \"112123123412345$$$\\dots$$$\" which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from $$$1$$$ to $$$1$$$, the second one \u2014 from $$$1$$$ to $$$2$$$, the third one \u2014 from $$$1$$$ to $$$3$$$, $$$\\dots$$$, the $$$i$$$-th block consists of all numbers from $$$1$$$ to $$$i$$$. So the first $$$56$$$ elements of the sequence are \"11212312341234512345612345671234567812345678912345678910\". Elements of the sequence are numbered from one. For example, the $$$1$$$-st element of the sequence is $$$1$$$, the $$$3$$$-rd element of the sequence is $$$2$$$, the $$$20$$$-th element of the sequence is $$$5$$$, the $$$38$$$-th element is $$$2$$$, the $$$56$$$-th element of the sequence is $$$0$$$.Your task is to answer $$$q$$$ independent queries. In the $$$i$$$-th query you are given one integer $$$k_i$$$. Calculate the digit at the position $$$k_i$$$ of the sequence.","input_specification":"The first line of the input contains one integer $$$q$$$ ($$$1 \\le q \\le 500$$$) \u2014 the number of queries.\nThe $$$i$$$-th of the following $$$q$$$ lines contains one integer $$$k_i$$$ $$$(1 \\le k_i \\le 10^9)$$$ \u2014 the description of the corresponding query.\n","output_specification":"Print $$$q$$$ lines. In the $$$i$$$-th line print one digit $$$x_i$$$ $$$(0 \\le x_i \\le 9)$$$ \u2014 the answer to the query $$$i$$$, i.e. $$$x_i$$$ should be equal to the element at the position $$$k_i$$$ of the sequence.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"src_uid":"1216_E1","lang_cluster":"Python","difficulty":1900,"human_solution":"import sys\r\nfrom collections import deque\r\ninput = sys.stdin.readline\r\ndef fgh():\r\n return [int(xx) for xx in input().split()]\r\ndef fg():\r\n return int(input())\r\nstep = [1]\r\nfor i in range(22):\r\n step.append(step[-1] * 10)\r\ndef f(n):\r\n ans = 0\r\n for i in range(20):\r\n ans += max(0, n - step[i] + 1)\r\n return ans\r\ndef g(n):\r\n ans = 0\r\n for i in range(20):\r\n q = max(0, n - step[i] + 1)\r\n ans += q * (q + 1) \/\/ 2 + q * max(0, n - (step[i] + q))\r\n return ans\r\nfor __ in range(fg()):\r\n n = fg()\r\n l = 0\r\n r = 10 ** 19\r\n while r - l > 1:\r\n m = (l + r) \/\/ 2\r\n if g(m) < n:\r\n l = m\r\n else:\r\n r = m\r\n n -= g(l)\r\n r = l + 1\r\n l = 0\r\n while r - l > 1:\r\n m = (l + r) \/\/ 2\r\n if f(m) < n:\r\n l = m\r\n else:\r\n r = m\r\n n -= f(l)\r\n print(str(l + 1)[n - 1])\r\n","testcases":"[{'input': ['5\\r\\n1\\r\\n3\\r\\n20\\r\\n38\\r\\n56\\r\\n'], 'output': ['1\\r\\n2\\r\\n5\\r\\n2\\r\\n0\\r\\n']}, {'input': ['4\\r\\n2132\\r\\n506\\r\\n999999999\\r\\n1000000000\\r\\n'], 'output': ['8\\r\\n2\\r\\n9\\r\\n8\\r\\n']}, {'input': ['1\\r\\n388645\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1\\r\\n472069\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n555493\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n671621\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1\\r\\n755045\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n838469\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n921893\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1\\r\\n123151223\\r\\n'], 'output': ['7\\r\\n']}, {'input': ['2\\r\\n555831672\\r\\n1395496\\r\\n'], 'output': ['5\\r\\n1\\r\\n']}, {'input': ['10\\r\\n1\\r\\n10\\r\\n100\\r\\n1000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000\\r\\n'], 'output': ['1\\r\\n4\\r\\n1\\r\\n4\\r\\n9\\r\\n2\\r\\n6\\r\\n2\\r\\n6\\r\\n8\\r\\n']}]","id":159} {"description":"The only difference between the easy and the hard versions is the maximum value of $$$k$$$.You are given an infinite sequence of form \"112123123412345$$$\\dots$$$\" which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from $$$1$$$ to $$$1$$$, the second one \u2014 from $$$1$$$ to $$$2$$$, the third one \u2014 from $$$1$$$ to $$$3$$$, $$$\\dots$$$, the $$$i$$$-th block consists of all numbers from $$$1$$$ to $$$i$$$. So the first $$$56$$$ elements of the sequence are \"11212312341234512345612345671234567812345678912345678910\". Elements of the sequence are numbered from one. For example, the $$$1$$$-st element of the sequence is $$$1$$$, the $$$3$$$-rd element of the sequence is $$$2$$$, the $$$20$$$-th element of the sequence is $$$5$$$, the $$$38$$$-th element is $$$2$$$, the $$$56$$$-th element of the sequence is $$$0$$$.Your task is to answer $$$q$$$ independent queries. In the $$$i$$$-th query you are given one integer $$$k_i$$$. Calculate the digit at the position $$$k_i$$$ of the sequence.","input_specification":"The first line of the input contains one integer $$$q$$$ ($$$1 \\le q \\le 500$$$) \u2014 the number of queries.\nThe $$$i$$$-th of the following $$$q$$$ lines contains one integer $$$k_i$$$ $$$(1 \\le k_i \\le 10^{18})$$$ \u2014 the description of the corresponding query.\n","output_specification":"Print $$$q$$$ lines. In the $$$i$$$-th line print one digit $$$x_i$$$ $$$(0 \\le x_i \\le 9)$$$ \u2014 the answer to the query $$$i$$$, i.e. $$$x_i$$$ should be equal to the element at the position $$$k_i$$$ of the sequence.\n","notes":null,"sample_inputs":[],"sample_outputs":[],"src_uid":"1216_E2","lang_cluster":"Python","difficulty":2200,"human_solution":"from math import *\n\n\ndef quick_pow(n, p):\n ret = 1\n while p:\n if p & 1:\n ret *= n\n n *= n\n p >>= 1\n return ret\n\n\ndef len(n):\n cnt = 0\n while n:\n cnt += 1\n n = int(n\/10)\n return cnt\n\n\nsum = [0, 45, 9045, 1395495, 189414495, 23939649495, 2893942449495,\n 339393974949495, 38939394344949495, 4393939398494949495]\npre = [0, 9, 189, 2889, 38889, 488889,\n 5888889, 68888889, 788888889, 8888888889]\n# int q, l\n# llk, start, cnt, finish_int, i, left, right, mid, a, b, c\nq = int(input())\nfor a in range(q):\n k = int(input())\n # l = upper_bound(sum, sum + 10, k) - sum\n for l in range(11):\n if sum[l] >= k:\n break\n k -= sum[l - 1]\n start = pre[l - 1] + l\n # \/\/ left = 0, right = quick_pow(10, l) - quick_pow(10, l - 1) - 1\n # \/\/ while (left < right) {\n # \/\/ mid = (left + right) >> 1\n # \/\/ if ((start + start + l * (mid - 1)) * mid \/ 2 < k)\n # \/\/ left = mid + 1\n # \/\/ else\n # \/\/ right = mid - 1\n # \/\/ }\n # \/\/ if ((start + start + l * (right - 1)) * right \/ 2 > k)\n # \/\/ --right\n a = l\n b = 2 * start + l\n c = 2 * start - 2 * k\n cnt = int(ceil((-b + sqrt(b * b - 4 * a * c)) \/ (2 * a)))\n # print(int((start + start + (cnt - 1) * l) * cnt))\n # print(int(int((start + start + (cnt - 1) * l) * cnt)\/\/2))\n k -= ((start + start + (cnt - 1) * l) * cnt \/\/ 2)\n # \/\/ if (right > 1)\n # \/\/ k -= pre[len(right) - 1] + len(right - 1) * (right - 1 - quick_pow(10, len(right) - 1) + 1)\n finish_int = quick_pow(10, l - 1) + cnt\n left = 1\n right = finish_int\n while left < right:\n mid = (left + right) >> 1\n t = len(mid)\n if pre[t - 1] + len(mid) * (mid - quick_pow(10, t - 1) + 1) < k:\n left = mid + 1\n else:\n right = mid\n t = len(right)\n if right > 1:\n k -= pre[t - 1] + len(right - 1) * (right - quick_pow(10, t - 1))\n # stringstream ss\n # string str\n # ss << left\n # ss >> str\n # cout << str[k - 1] << endl\n right = str(right)\n print(right[k-1])\n\n \t \t\t \t\t \t\t \t \t \t\t \t \t","testcases":"[{'input': ['5\\r\\n1\\r\\n3\\r\\n20\\r\\n38\\r\\n56\\r\\n'], 'output': ['1\\r\\n2\\r\\n5\\r\\n2\\r\\n0\\r\\n']}, {'input': ['4\\r\\n2132\\r\\n506\\r\\n999999999999999999\\r\\n1000000000000000000\\r\\n'], 'output': ['8\\r\\n2\\r\\n4\\r\\n1\\r\\n']}, {'input': ['1\\r\\n388645\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1\\r\\n472069\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n555493\\r\\n'], 'output': ['2\\r\\n']}, {'input': ['1\\r\\n671621\\r\\n'], 'output': ['3\\r\\n']}, {'input': ['1\\r\\n755045\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n838469\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n921893\\r\\n'], 'output': ['8\\r\\n']}, {'input': ['1\\r\\n1231513123\\r\\n'], 'output': ['6\\r\\n']}, {'input': ['1\\r\\n306200613881388645\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n307026857059472069\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1\\r\\n307853100237555493\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n308679339120671621\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['1\\r\\n309505582298755045\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n310331825476838469\\r\\n'], 'output': ['5\\r\\n']}, {'input': ['1\\r\\n311158068654921893\\r\\n'], 'output': ['4\\r\\n']}, {'input': ['2\\r\\n555221491191831672\\r\\n1395496\\r\\n'], 'output': ['7\\r\\n1\\r\\n']}, {'input': ['19\\r\\n1\\r\\n10\\r\\n100\\r\\n1000\\r\\n10000\\r\\n100000\\r\\n1000000\\r\\n10000000\\r\\n100000000\\r\\n1000000000\\r\\n10000000000\\r\\n100000000000\\r\\n1000000000000\\r\\n10000000000000\\r\\n100000000000000\\r\\n1000000000000000\\r\\n10000000000000000\\r\\n100000000000000000\\r\\n1000000000000000000\\r\\n'], 'output': ['1\\r\\n4\\r\\n1\\r\\n4\\r\\n9\\r\\n2\\r\\n6\\r\\n2\\r\\n6\\r\\n8\\r\\n1\\r\\n1\\r\\n9\\r\\n8\\r\\n3\\r\\n7\\r\\n6\\r\\n1\\r\\n1\\r\\n']}, {'input': ['1\\r\\n9124\\r\\n'], 'output': ['4\\r\\n']}]","id":160} {"description":"You are given a directed graph with $$$n$$$ vertices and $$$m$$$ directed edges without self-loops or multiple edges.Let's denote the $$$k$$$-coloring of a digraph as following: you color each edge in one of $$$k$$$ colors. The $$$k$$$-coloring is good if and only if there no cycle formed by edges of same color.Find a good $$$k$$$-coloring of given digraph with minimum possible $$$k$$$.","input_specification":"The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \\le n \\le 5000$$$, $$$1 \\le m \\le 5000$$$) \u2014 the number of vertices and edges in the digraph, respectively.\nNext $$$m$$$ lines contain description of edges \u2014 one per line. Each edge is a pair of integers $$$u$$$ and $$$v$$$ ($$$1 \\le u, v \\le n$$$, $$$u \\ne v$$$) \u2014 there is directed edge from $$$u$$$ to $$$v$$$ in the graph.\nIt is guaranteed that each ordered pair $$$(u, v)$$$ appears in the list of edges at most once.\n","output_specification":"In the first line print single integer $$$k$$$ \u2014 the number of used colors in a good $$$k$$$-coloring of given graph.\nIn the second line print $$$m$$$ integers $$$c_1, c_2, \\dots, c_m$$$ ($$$1 \\le c_i \\le k$$$), where $$$c_i$$$ is a color of the $$$i$$$-th edge (in order as they are given in the input).\nIf there are multiple answers print any of them (you still have to minimize $$$k$$$).\n","notes":null,"sample_inputs":[],"sample_outputs":[],"src_uid":"1217_D","lang_cluster":"Python","difficulty":2100,"human_solution":"class Graph:\r\n def __init__(self, n, m):\r\n self.nodes = n\r\n self.edges = m\r\n self.adj = [[] for i in range(n)]\r\n self.color = [1 for i in range(m)]\r\n self.vis = [0 for i in range(n)]\r\n self.colors = 1\r\n\r\n def add_edge(self, u, v, i):\r\n self.adj[u].append((i, v))\r\n\r\n def dfs(self, u):\r\n self.vis[u] = 1\r\n for i, v in self.adj[u]:\r\n if self.vis[v] == 1:\r\n self.colors = 2\r\n self.color[i] = 2\r\n if self.vis[v] == 0:\r\n self.dfs(v)\r\n self.vis[u] = 2\r\n\r\n def solve(self):\r\n for i in range(self.nodes):\r\n if self.vis[i] == 0:\r\n self.dfs(i)\r\n print(self.colors)\r\n print(' '.join(map(str, self.color)))\r\n\r\n\r\nn, m = map(int, input().split(' '))\r\ngraph = Graph(n, m)\r\nfor i in range(m):\r\n u, v = map(int, input().split(' '))\r\n graph.add_edge(u-1, v-1, i)\r\ngraph.solve()","testcases":"[{'input': ['4 5\\r\\n1 2\\r\\n1 3\\r\\n3 4\\r\\n2 4\\r\\n1 4\\r\\n'], 'output': ['1\\r\\n1 1 1 1 1 \\r\\n']}, {'input': ['3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n'], 'output': ['2\\r\\n1 1 2 \\r\\n']}, {'input': ['6 8\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n4 3\\r\\n5 4\\r\\n6 5\\r\\n1 6\\r\\n6 2\\r\\n'], 'output': ['2\\r\\n1 1 2 1 1 1 1 1 \\r\\n']}, {'input': ['3 4\\r\\n1 2\\r\\n2 3\\r\\n3 2\\r\\n3 1\\r\\n'], 'output': ['2\\r\\n1 1 2 2 \\r\\n']}, {'input': ['3 6\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n2 1\\r\\n1 3\\r\\n3 2\\r\\n'], 'output': ['2\\r\\n1 1 2 2 1 2 \\r\\n']}, {'input': ['3 6\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n2 1\\r\\n3 2\\r\\n1 3\\r\\n'], 'output': ['2\\r\\n1 1 2 2 2 1 \\r\\n']}, {'input': ['10 2\\r\\n8 7\\r\\n10 5\\r\\n'], 'output': ['1\\r\\n1 1 \\r\\n']}, {'input': ['12 7\\r\\n11 8\\r\\n4 2\\r\\n7 5\\r\\n2 9\\r\\n7 2\\r\\n5 4\\r\\n10 8\\r\\n'], 'output': ['1\\r\\n1 1 1 1 1 1 1 \\r\\n']}, {'input': ['2 1\\r\\n2 1\\r\\n'], 'output': ['1\\r\\n1 \\r\\n']}, {'input': ['2 2\\r\\n2 1\\r\\n1 2\\r\\n'], 'output': ['2\\r\\n2 1 \\r\\n']}, {'input': ['7 10\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 1\\r\\n1 3\\r\\n3 5\\r\\n5 7\\r\\n'], 'output': ['2\\r\\n1 1 1 1 1 1 2 1 1 1 \\r\\n']}, {'input': ['14 50\\r\\n8 10\\r\\n5 11\\r\\n3 6\\r\\n14 6\\r\\n4 11\\r\\n6 8\\r\\n9 8\\r\\n3 7\\r\\n4 9\\r\\n4 8\\r\\n5 10\\r\\n13 5\\r\\n8 3\\r\\n13 12\\r\\n5 8\\r\\n4 5\\r\\n12 1\\r\\n14 10\\r\\n10 13\\r\\n6 13\\r\\n2 5\\r\\n6 4\\r\\n14 4\\r\\n11 12\\r\\n5 7\\r\\n1 13\\r\\n9 1\\r\\n5 12\\r\\n9 7\\r\\n7 10\\r\\n3 13\\r\\n3 10\\r\\n5 4\\r\\n13 3\\r\\n11 2\\r\\n10 3\\r\\n7 11\\r\\n7 3\\r\\n13 14\\r\\n6 2\\r\\n7 1\\r\\n14 11\\r\\n10 9\\r\\n4 3\\r\\n11 5\\r\\n12 2\\r\\n8 12\\r\\n13 10\\r\\n12 11\\r\\n2 10\\r\\n'], 'output': ['2\\r\\n2 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 2 1 2 2 2 1 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2 2 1 2 2 1 1 2 2 1 2 1 2 1 \\r\\n']}, {'input': ['19 27\\r\\n6 13\\r\\n15 5\\r\\n12 15\\r\\n16 18\\r\\n9 18\\r\\n9 17\\r\\n1 16\\r\\n3 14\\r\\n8 7\\r\\n19 7\\r\\n14 6\\r\\n16 13\\r\\n15 12\\r\\n14 12\\r\\n13 5\\r\\n2 3\\r\\n13 11\\r\\n6 8\\r\\n7 14\\r\\n3 17\\r\\n8 2\\r\\n9 12\\r\\n18 14\\r\\n11 16\\r\\n17 3\\r\\n13 18\\r\\n1 3\\r\\n'], 'output': ['2\\r\\n1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 2 2 1 \\r\\n']}, {'input': ['8 6\\r\\n3 5\\r\\n8 3\\r\\n3 6\\r\\n8 5\\r\\n4 6\\r\\n2 5\\r\\n'], 'output': ['1\\r\\n1 1 1 1 1 1 \\r\\n']}, {'input': ['3 4\\r\\n3 1\\r\\n1 3\\r\\n2 3\\r\\n3 2\\r\\n'], 'output': ['2\\r\\n2 1 2 1 \\r\\n']}, {'input': ['5 12\\r\\n4 1\\r\\n4 5\\r\\n5 3\\r\\n5 4\\r\\n2 4\\r\\n5 1\\r\\n1 5\\r\\n1 4\\r\\n3 4\\r\\n3 5\\r\\n2 1\\r\\n4 2\\r\\n'], 'output': ['2\\r\\n2 2 1 1 2 2 1 1 1 2 2 1 \\r\\n']}, {'input': ['3 5\\r\\n1 3\\r\\n1 2\\r\\n3 2\\r\\n3 1\\r\\n2 3\\r\\n'], 'output': ['2\\r\\n1 1 1 2 2 \\r\\n']}, {'input': ['16 21\\r\\n7 9\\r\\n5 1\\r\\n3 9\\r\\n4 7\\r\\n15 5\\r\\n12 13\\r\\n12 7\\r\\n7 5\\r\\n1 4\\r\\n9 3\\r\\n13 16\\r\\n13 15\\r\\n9 15\\r\\n7 15\\r\\n16 3\\r\\n13 5\\r\\n3 7\\r\\n1 7\\r\\n5 13\\r\\n1 2\\r\\n2 9\\r\\n'], 'output': ['2\\r\\n1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 2 2 1 1 1 1 \\r\\n']}, {'input': ['18 74\\r\\n12 17\\r\\n6 3\\r\\n7 5\\r\\n11 13\\r\\n13 12\\r\\n16 2\\r\\n15 3\\r\\n10 6\\r\\n18 1\\r\\n6 1\\r\\n10 18\\r\\n3 16\\r\\n16 5\\r\\n14 12\\r\\n12 1\\r\\n9 6\\r\\n13 11\\r\\n11 17\\r\\n13 1\\r\\n1 7\\r\\n18 12\\r\\n6 8\\r\\n11 15\\r\\n2 9\\r\\n9 12\\r\\n7 4\\r\\n8 15\\r\\n6 9\\r\\n11 9\\r\\n11 18\\r\\n3 6\\r\\n5 7\\r\\n1 16\\r\\n2 6\\r\\n17 11\\r\\n4 8\\r\\n14 1\\r\\n7 13\\r\\n18 14\\r\\n7 16\\r\\n15 5\\r\\n11 2\\r\\n18 17\\r\\n9 16\\r\\n4 13\\r\\n17 5\\r\\n8 6\\r\\n18 6\\r\\n6 4\\r\\n17 10\\r\\n10 7\\r\\n5 9\\r\\n7 6\\r\\n17 1\\r\\n9 13\\r\\n7 11\\r\\n9 5\\r\\n4 17\\r\\n18 15\\r\\n12 4\\r\\n8 3\\r\\n9 2\\r\\n7 2\\r\\n8 4\\r\\n8 11\\r\\n16 10\\r\\n13 18\\r\\n16 12\\r\\n3 10\\r\\n18 10\\r\\n12 3\\r\\n12 14\\r\\n9 14\\r\\n3 11\\r\\n'], 'output': ['2\\r\\n1 1 1 1 2 1 2 2 2 2 1 1 2 2 2 1 2 2 2 1 1 1 1 2 1 1 1 2 2 2 2 2 1 2 1 1 2 1 1 1 2 1 1 1 1 2 2 2 1 2 2 1 1 2 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 2 2 1 1 1 \\r\\n']}, {'input': ['14 23\\r\\n8 5\\r\\n6 3\\r\\n5 9\\r\\n3 1\\r\\n6 1\\r\\n13 11\\r\\n11 2\\r\\n14 4\\r\\n14 5\\r\\n4 2\\r\\n10 3\\r\\n14 6\\r\\n4 1\\r\\n8 2\\r\\n11 1\\r\\n14 1\\r\\n5 13\\r\\n1 4\\r\\n9 5\\r\\n8 13\\r\\n1 2\\r\\n4 8\\r\\n2 6\\r\\n'], 'output': ['2\\r\\n1 1 1 2 2 1 1 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 \\r\\n']}, {'input': ['4 4\\r\\n4 2\\r\\n3 1\\r\\n2 3\\r\\n4 1\\r\\n'], 'output': ['1\\r\\n1 1 1 1 \\r\\n']}, {'input': ['10 44\\r\\n9 2\\r\\n3 9\\r\\n3 10\\r\\n6 8\\r\\n10 9\\r\\n2 1\\r\\n5 9\\r\\n10 1\\r\\n4 2\\r\\n3 1\\r\\n3 6\\r\\n3 7\\r\\n1 9\\r\\n1 4\\r\\n1 8\\r\\n9 7\\r\\n7 3\\r\\n1 6\\r\\n4 9\\r\\n7 5\\r\\n1 2\\r\\n4 3\\r\\n10 7\\r\\n8 1\\r\\n8 10\\r\\n9 8\\r\\n6 10\\r\\n6 5\\r\\n2 9\\r\\n9 1\\r\\n3 4\\r\\n5 7\\r\\n6 3\\r\\n2 8\\r\\n7 6\\r\\n4 5\\r\\n8 6\\r\\n2 10\\r\\n10 2\\r\\n5 8\\r\\n2 7\\r\\n8 7\\r\\n3 5\\r\\n9 6\\r\\n'], 'output': ['2\\r\\n1 2 2 2 2 2 2 2 2 2 1 2 1 1 1 1 1 1 2 1 1 2 1 2 1 1 2 1 2 2 1 2 2 1 1 1 1 1 2 2 1 1 1 1 \\r\\n']}]","id":161} {"description":"You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails needed to nail all the segments down?","input_specification":"The first line of the input contains single integer number n (1\u2264n\u22641000) \u2014 amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers \u2014 endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points.\n","output_specification":"The first line should contain one integer number \u2014 the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any.\n","notes":null,"sample_inputs":["2\n0 2\n2 5\n","5\n0 3\n4 2\n4 8\n8 10\n7 7\n"],"sample_outputs":["1\n2 ","3\n7 10 3\n"],"src_uid":"22_D","lang_cluster":"Python","difficulty":1900,"human_solution":"n = int(input())\nsegments = []\n\nfor _ in range(n):\n l, r = sorted(map(int, input().split()))\n segments.append([l, r])\n \nsegments.sort(key = lambda s: s[1])\n\npinz = []\n\nfor l, r in segments:\n if len(pinz) == 0 or l > pinz[-1]:\n pinz.append(r)\n\nprint(len(pinz))\nprint(*pinz)\n\t\t \t\t \t\t\t \t\t \t\t\t\t\t\t\t \t\t\t\t\t","testcases":"[{'input': ['2\\r\\n0 2\\r\\n2 5\\r\\n'], 'output': ['1\\r\\n2 ']}, {'input': ['5\\r\\n0 3\\r\\n4 2\\r\\n4 8\\r\\n8 10\\r\\n7 7\\r\\n'], 'output': ['3\\r\\n3 7 10 ']}, {'input': ['3\\r\\n40 -83\\r\\n52 -80\\r\\n-21 -4\\r\\n'], 'output': ['1\\r\\n-4 ']}, {'input': ['4\\r\\n67 -88\\r\\n37 -62\\r\\n-26 91\\r\\n-99 -50\\r\\n'], 'output': ['2\\r\\n-50 91 ']}, {'input': ['5\\r\\n45 58\\r\\n22 6\\r\\n-32 36\\r\\n49 -37\\r\\n43 62\\r\\n'], 'output': ['2\\r\\n22 58 ']}, {'input': ['10\\r\\n47 -85\\r\\n71 40\\r\\n-87 64\\r\\n76 73\\r\\n52 -51\\r\\n-20 -57\\r\\n-14 -77\\r\\n-45 -11\\r\\n-56 -48\\r\\n81 20\\r\\n'], 'output': ['4\\r\\n-48 -11 71 76 ']}, {'input': ['35\\r\\n-47 61\\r\\n-73 -15\\r\\n9 43\\r\\n43 -49\\r\\n13 -6\\r\\n48 -65\\r\\n49 -84\\r\\n-6 76\\r\\n40 6\\r\\n-41 11\\r\\n-63 -42\\r\\n-7 -66\\r\\n47 -98\\r\\n-17 61\\r\\n79 99\\r\\n47 -98\\r\\n61 31\\r\\n85 72\\r\\n-50 -17\\r\\n-67 45\\r\\n14 -50\\r\\n-45 61\\r\\n-6 -96\\r\\n-47 -83\\r\\n56 -58\\r\\n-69 -15\\r\\n14 20\\r\\n-95 -82\\r\\n47 93\\r\\n-4 -7\\r\\n70 9\\r\\n91 -18\\r\\n-71 31\\r\\n55 -20\\r\\n81 -8\\r\\n'], 'output': ['6\\r\\n-82 -42 -4 20 61 85 ']}, {'input': ['1\\r\\n0 0\\r\\n'], 'output': ['1\\r\\n0 ']}, {'input': ['4\\r\\n1 1\\r\\n0 0\\r\\n10000 10000\\r\\n-10000 -10000\\r\\n'], 'output': ['4\\r\\n-10000 0 1 10000 ']}, {'input': ['3\\r\\n55 55\\r\\n55 55\\r\\n55 55\\r\\n'], 'output': ['1\\r\\n55 ']}, {'input': ['4\\r\\n55 55\\r\\n55 55\\r\\n55 55\\r\\n55 56\\r\\n'], 'output': ['1\\r\\n55 ']}, {'input': ['1\\r\\n-2244 5023\\r\\n'], 'output': ['1\\r\\n5023 ']}]","id":162} {"description":"Cosider a sequence, consisting of n integers: a1, a2, ..., an. Jeff can perform the following operation on sequence a: take three integers v, t, k (1\u2264v,t\u2264n;\u00a00\u2264k;\u00a0v+tk\u2264n), such that av = av+t, av+t = av+2t, ..., av+t(k-1) = av+tk; remove elements av, av+t, ..., av+t\u00b7k from the sequence a, the remaining elements should be reindexed a1,a2,...,an-k-1. permute in some order the remaining elements of sequence a. A beauty of a sequence a is the minimum number of operations that is needed to delete all elements from sequence a.Jeff's written down a sequence of m integers b1, b2, ..., bm. Now he wants to ask q questions. Each question can be described with two integers li,ri. The answer to the question is the beauty of sequence bli, bli+1, ..., bri. You are given the sequence b and all questions. Help Jeff, answer all his questions.","input_specification":"The first line contains integer m (1\u2264m\u226410^5). The next line contains m integers b1, b2, ..., bm (1\u2264bi\u226410^5). \nThe third line contains integer q (1\u2264q\u226410^5) \u2014 the number of questions. The next q lines contain pairs of integers, i-th of them contains a pair of integers li, ri (1\u2264li\u2264ri\u2264m) \u2014 the description of i-th question.\n","output_specification":"In q lines print the answers to Jeff's queries. Print the answers according to the order of questions in input.\n","notes":null,"sample_inputs":["5\n2 2 1 1 2\n5\n1 5\n1 1\n2 2\n1 3\n2 3\n","10\n2 1 3 3 3 3 1 3 1 1\n10\n4 8\n2 10\n1 10\n4 4\n1 3\n2 4\n6 7\n1 9\n2 5\n1 1\n"],"sample_outputs":["2\n1\n1\n2\n2\n","2\n3\n3\n1\n3\n2\n2\n3\n2\n1\n"],"src_uid":"351_D","lang_cluster":"Python","difficulty":2700,"human_solution":"from bisect import bisect_left, bisect_right\r\nimport sys\r\nreadline=sys.stdin.readline\r\n\r\nclass Segment_Tree:\r\n def __init__(self,N,f,e,lst=None):\r\n self.f=f\r\n self.e=e\r\n self.N=N\r\n if lst==None:\r\n self.segment_tree=[self.e]*2*self.N\r\n else:\r\n assert len(lst)<=self.N\r\n self.segment_tree=[self.e]*self.N+[x for x in lst]+[self.e]*(N-len(lst))\r\n for i in range(self.N-1,0,-1):\r\n self.segment_tree[i]=self.f(self.segment_tree[i<<1],self.segment_tree[i<<1|1])\r\n\r\n def __getitem__(self,i):\r\n if type(i)==int:\r\n if -self.N<=i<0:\r\n return self.segment_tree[i+self.N*2]\r\n elif 0<=i1:\r\n i>>= 1\r\n self.segment_tree[i]=self.f(self.segment_tree[i<<1],self.segment_tree[i<<1|1])\r\n\r\n def Build(self,lst):\r\n for i,x in enumerate(lst,self.N):\r\n self.segment_tree[i]=x\r\n for i in range(self.N-1,0,-1):\r\n self.segment_tree[i]=self.f(self.segment_tree[i<<1],self.segment_tree[i<<1|1])\r\n\r\n def Fold(self,L=None,R=None):\r\n if L==None:\r\n L=self.N\r\n else:\r\n L+=self.N\r\n if R==None:\r\n R=self.N*2\r\n else:\r\n R+=self.N\r\n vL=self.e\r\n vR=self.e\r\n while L>=1\r\n R>>=1\r\n return self.f(vL,vR)\r\n\r\n def Fold_Index(self,L=None,R=None):\r\n if L==None:\r\n L=self.N\r\n else:\r\n L+=self.N\r\n if R==None:\r\n R=self.N*2\r\n else:\r\n R+=self.N\r\n if L==R:\r\n return None\r\n x=self.Fold(L-self.N,R-self.N)\r\n while L>=1\r\n R>>=1\r\n while i>=1\r\n vv=self.f(v,self.segment_tree[l])\r\n if f(vv):\r\n v=vv\r\n l+=1\r\n if 2*self.N==l<<(self.N.bit_length()-l.bit_length()+1):\r\n return self.N\r\n else:\r\n while l1 and r%2:\r\n r>>=1\r\n vv=self.f(self.segment_tree[r],v)\r\n if f(vv):\r\n v=vv\r\n if 2*self.N==r<<(self.N.bit_length()-r.bit_length()+1):\r\n return 0\r\n else:\r\n while r>h)\r\n\r\n def Operate_Range(self,a,L=None,R=None):\r\n if L==None or L<-self.N:\r\n L=self.N\r\n elif self.N<=L:\r\n L=self.N*2\r\n elif L<0:\r\n L+=self.N*2\r\n else:\r\n L+=self.N\r\n if R==None or self.N<=R:\r\n R=self.N*2\r\n elif R<-self.N:\r\n R=self.N\r\n elif R<0:\r\n R+=self.N*2\r\n else:\r\n R+=self.N\r\n L0=L\/\/(L&-L)\r\n R0=R\/\/(R&-R)-1\r\n self.Propagate_Above(L0)\r\n self.Propagate_Above(R0)\r\n while L>=1\r\n R>>=1\r\n\r\n def Update(self):\r\n for i in range(1,self.N):\r\n self.Propagate_At(i)\r\n self.segment_tree_act[i]=self.e_act\r\n\r\n def __str__(self):\r\n self.Update()\r\n return '['+', '.join(map(str,[self.operate(x,a) for x,a in zip(self.lst,self.segment_tree_act[self.N:])]))+']'\r\n\r\nM=int(readline())\r\nB=list(map(int,readline().split()))\r\nQ=int(readline())\r\nquery=[[] for l in range(M)]\r\nfor i in range(Q):\r\n l,r=map(int,readline().split())\r\n l-=1\r\n query[l].append((r,i))\r\nmax_B=max(B)\r\nidx=[[] for b in range(max_B+1)]\r\nfor i in range(M-1,-1,-1):\r\n idx[B[i]].append(i)\r\nans_lst=[None]*Q\r\nST=Segment_Tree(M,lambda x,y:x+y,0)\r\nfor lst in idx:\r\n if lst:\r\n ST[lst.pop()]+=1\r\nfor l in range(M):\r\n for r,i in query[l]:\r\n ans_lst[i]=ST.Fold(l,r)\r\n b=B[l]\r\n if idx[b]:\r\n ST[idx[b].pop()]+=1\r\nfor i in range(M):\r\n idx[B[i]].append(i)\r\ninf=1<<30\r\nDST=Dual_Segment_Tree(M+1,lambda x,y:x+y,0,lambda x,y:x+y,[0]*(M+1))\r\nbound=[[] for i in range(max_B+1)]\r\nfor b in range(max_B+1):\r\n if not idx[b]:\r\n continue\r\n l=len(idx[b])\r\n for i in range(1,l-1):\r\n if idx[b][i]*2!=idx[b][i-1]+idx[b][i+1]:\r\n bound[b].append(i)\r\n l=idx[b][0]+1\r\n if bound[b]:\r\n r=idx[b][bound[b][0]+1]+1\r\n else:\r\n r=M+1\r\n DST.Operate_Range(1,l,r)\r\nfor l in range(M):\r\n for r,i in query[l]:\r\n if DST[r]==0:\r\n ans_lst[i]+=1\r\n b=B[l]\r\n if idx[b][-1]==l:\r\n DST.Operate_Range(-1,l+1,M+1)\r\n else:\r\n i=bisect_left(idx[b],l)\r\n j=bisect_left(bound[b],i+1)\r\n if j==len(bound[b]):\r\n DST.Operate_Range(-1,l+1,idx[b][i+1]+1)\r\n else:\r\n DST.Operate_Range(-1,l+1,idx[b][bound[b][j]+1]+1)\r\n i+=1\r\n j=bisect_left(bound[b],i+1)\r\n if j==len(bound[b]):\r\n r=M+1\r\n else:\r\n r=idx[b][bound[b][j]+1]+1\r\n DST.Operate_Range(1,idx[b][i]+1,r)\r\nprint(*ans_lst,sep=\"\\n\")\r\n\r\n","testcases":"[{'input': ['5\\r\\n2 2 1 1 2\\r\\n5\\r\\n1 5\\r\\n1 1\\r\\n2 2\\r\\n1 3\\r\\n2 3\\r\\n'], 'output': ['2\\r\\n1\\r\\n1\\r\\n2\\r\\n2\\r\\n']}, {'input': ['10\\r\\n2 1 3 3 3 3 1 3 1 1\\r\\n10\\r\\n4 8\\r\\n2 10\\r\\n1 10\\r\\n4 4\\r\\n1 3\\r\\n2 4\\r\\n6 7\\r\\n1 9\\r\\n2 5\\r\\n1 1\\r\\n'], 'output': ['2\\r\\n3\\r\\n3\\r\\n1\\r\\n3\\r\\n2\\r\\n2\\r\\n3\\r\\n2\\r\\n1\\r\\n']}, {'input': ['15\\r\\n3 3 2 2 1 2 4 1 3 1 1 3 1 4 1\\r\\n15\\r\\n4 10\\r\\n8 9\\r\\n12 12\\r\\n7 9\\r\\n11 12\\r\\n1 1\\r\\n4 10\\r\\n12 13\\r\\n2 2\\r\\n3 5\\r\\n5 6\\r\\n1 1\\r\\n2 3\\r\\n2 4\\r\\n7 14\\r\\n'], 'output': ['4\\r\\n2\\r\\n1\\r\\n3\\r\\n2\\r\\n1\\r\\n4\\r\\n2\\r\\n1\\r\\n2\\r\\n2\\r\\n1\\r\\n2\\r\\n2\\r\\n3\\r\\n']}, {'input': ['20\\r\\n3 2 2 1 4 4 1 2 3 1 1 5 5 3 4 4 1 2 3 1\\r\\n20\\r\\n13 17\\r\\n2 2\\r\\n5 5\\r\\n19 20\\r\\n5 9\\r\\n10 14\\r\\n2 2\\r\\n7 15\\r\\n10 12\\r\\n16 17\\r\\n9 9\\r\\n2 3\\r\\n4 4\\r\\n1 4\\r\\n11 19\\r\\n1 2\\r\\n1 18\\r\\n3 13\\r\\n10 18\\r\\n3 9\\r\\n'], 'output': ['4\\r\\n1\\r\\n1\\r\\n2\\r\\n4\\r\\n3\\r\\n1\\r\\n5\\r\\n2\\r\\n2\\r\\n1\\r\\n1\\r\\n1\\r\\n3\\r\\n5\\r\\n2\\r\\n5\\r\\n5\\r\\n5\\r\\n4\\r\\n']}, {'input': ['25\\r\\n3 1 3 4 1 3 5 3 6 6 2 1 1 1 6 1 3 4 2 6 6 1 5 6 6\\r\\n25\\r\\n1 1\\r\\n10 12\\r\\n1 6\\r\\n1 8\\r\\n17 18\\r\\n2 20\\r\\n1 2\\r\\n1 1\\r\\n8 17\\r\\n11 19\\r\\n3 5\\r\\n17 25\\r\\n14 19\\r\\n5 12\\r\\n1 6\\r\\n1 17\\r\\n14 14\\r\\n9 13\\r\\n10 14\\r\\n18 22\\r\\n6 22\\r\\n10 11\\r\\n13 20\\r\\n3 4\\r\\n17 21\\r\\n'], 'output': ['1\\r\\n3\\r\\n3\\r\\n4\\r\\n2\\r\\n6\\r\\n2\\r\\n1\\r\\n4\\r\\n5\\r\\n3\\r\\n6\\r\\n5\\r\\n5\\r\\n3\\r\\n6\\r\\n1\\r\\n3\\r\\n3\\r\\n4\\r\\n6\\r\\n2\\r\\n5\\r\\n2\\r\\n4\\r\\n']}, {'input': ['30\\r\\n5 2 2 6 5 7 1 4 7 4 7 4 5 5 2 5 3 6 7 4 1 5 4 1 2 1 1 7 2 1\\r\\n30\\r\\n1 23\\r\\n19 23\\r\\n10 14\\r\\n8 22\\r\\n6 16\\r\\n4 13\\r\\n13 25\\r\\n9 14\\r\\n16 16\\r\\n7 7\\r\\n11 11\\r\\n17 30\\r\\n17 29\\r\\n8 9\\r\\n9 9\\r\\n1 1\\r\\n1 11\\r\\n14 17\\r\\n8 25\\r\\n6 6\\r\\n16 26\\r\\n7 24\\r\\n10 24\\r\\n1 16\\r\\n2 13\\r\\n14 22\\r\\n5 14\\r\\n14 19\\r\\n8 23\\r\\n18 19\\r\\n'], 'output': ['7\\r\\n4\\r\\n3\\r\\n7\\r\\n5\\r\\n5\\r\\n7\\r\\n3\\r\\n1\\r\\n1\\r\\n1\\r\\n7\\r\\n7\\r\\n2\\r\\n1\\r\\n1\\r\\n6\\r\\n3\\r\\n7\\r\\n1\\r\\n7\\r\\n7\\r\\n7\\r\\n6\\r\\n6\\r\\n7\\r\\n4\\r\\n5\\r\\n7\\r\\n2\\r\\n']}, {'input': ['35\\r\\n8 6 1 3 8 8 1 6 5 6 5 2 8 2 3 5 5 2 1 6 5 8 1 4 5 1 7 8 6 5 1 3 6 7 6\\r\\n35\\r\\n18 32\\r\\n13 23\\r\\n20 22\\r\\n11 15\\r\\n8 8\\r\\n2 13\\r\\n2 3\\r\\n8 14\\r\\n17 26\\r\\n7 14\\r\\n16 32\\r\\n15 16\\r\\n14 35\\r\\n2 14\\r\\n15 20\\r\\n10 14\\r\\n4 19\\r\\n13 17\\r\\n9 13\\r\\n4 4\\r\\n18 24\\r\\n9 18\\r\\n8 8\\r\\n2 17\\r\\n4 6\\r\\n3 16\\r\\n30 31\\r\\n1 35\\r\\n2 12\\r\\n22 24\\r\\n17 17\\r\\n21 27\\r\\n3 5\\r\\n1 29\\r\\n12 12\\r\\n'], 'output': ['8\\r\\n6\\r\\n3\\r\\n4\\r\\n1\\r\\n6\\r\\n2\\r\\n4\\r\\n6\\r\\n5\\r\\n8\\r\\n2\\r\\n8\\r\\n6\\r\\n5\\r\\n4\\r\\n6\\r\\n4\\r\\n4\\r\\n1\\r\\n6\\r\\n5\\r\\n1\\r\\n6\\r\\n2\\r\\n6\\r\\n2\\r\\n8\\r\\n6\\r\\n3\\r\\n1\\r\\n5\\r\\n3\\r\\n8\\r\\n1\\r\\n']}, {'input': ['40\\r\\n7 5 2 8 5 4 1 5 6 7 7 9 9 2 1 6 2 5 4 7 6 1 6 7 5 9 4 8 4 6 8 1 7 2 3 7 4 5 2 9\\r\\n40\\r\\n25 36\\r\\n21 39\\r\\n1 26\\r\\n2 21\\r\\n11 31\\r\\n12 33\\r\\n4 4\\r\\n2 8\\r\\n6 6\\r\\n2 9\\r\\n2 24\\r\\n23 23\\r\\n25 39\\r\\n3 11\\r\\n10 21\\r\\n11 24\\r\\n39 39\\r\\n25 29\\r\\n3 7\\r\\n1 7\\r\\n1 2\\r\\n15 36\\r\\n5 34\\r\\n31 33\\r\\n6 30\\r\\n8 13\\r\\n10 37\\r\\n33 35\\r\\n14 39\\r\\n2 12\\r\\n11 12\\r\\n6 11\\r\\n33 34\\r\\n17 23\\r\\n17 35\\r\\n4 5\\r\\n17 29\\r\\n10 19\\r\\n2 25\\r\\n12 30\\r\\n'], 'output': ['9\\r\\n9\\r\\n8\\r\\n8\\r\\n8\\r\\n8\\r\\n1\\r\\n5\\r\\n1\\r\\n6\\r\\n8\\r\\n1\\r\\n9\\r\\n7\\r\\n7\\r\\n7\\r\\n1\\r\\n4\\r\\n5\\r\\n6\\r\\n2\\r\\n9\\r\\n8\\r\\n3\\r\\n8\\r\\n4\\r\\n9\\r\\n3\\r\\n9\\r\\n8\\r\\n2\\r\\n5\\r\\n2\\r\\n6\\r\\n9\\r\\n2\\r\\n8\\r\\n7\\r\\n8\\r\\n8\\r\\n']}, {'input': ['45\\r\\n10 9 3 4 5 1 3 4 2 10 9 10 9 10 2 4 6 2 5 3 6 4 9 10 3 9 8 1 2 5 9 2 10 4 6 10 8 10 9 1 2 5 8 6 6\\r\\n45\\r\\n27 31\\r\\n7 13\\r\\n1 10\\r\\n6 22\\r\\n14 36\\r\\n17 18\\r\\n26 44\\r\\n27 34\\r\\n14 39\\r\\n29 35\\r\\n33 44\\r\\n29 42\\r\\n7 10\\r\\n2 2\\r\\n12 30\\r\\n1 2\\r\\n2 32\\r\\n1 1\\r\\n14 42\\r\\n5 8\\r\\n16 36\\r\\n1 37\\r\\n17 23\\r\\n6 7\\r\\n16 25\\r\\n1 22\\r\\n40 44\\r\\n15 27\\r\\n12 28\\r\\n19 20\\r\\n12 14\\r\\n1 42\\r\\n6 19\\r\\n7 13\\r\\n27 38\\r\\n7 8\\r\\n29 38\\r\\n6 11\\r\\n4 17\\r\\n1 34\\r\\n4 5\\r\\n9 16\\r\\n4 8\\r\\n11 42\\r\\n9 20\\r\\n'], 'output': ['5\\r\\n5\\r\\n7\\r\\n8\\r\\n9\\r\\n2\\r\\n8\\r\\n7\\r\\n9\\r\\n6\\r\\n8\\r\\n8\\r\\n4\\r\\n1\\r\\n9\\r\\n2\\r\\n9\\r\\n1\\r\\n9\\r\\n4\\r\\n9\\r\\n9\\r\\n6\\r\\n2\\r\\n7\\r\\n8\\r\\n5\\r\\n8\\r\\n9\\r\\n2\\r\\n2\\r\\n9\\r\\n8\\r\\n5\\r\\n8\\r\\n2\\r\\n7\\r\\n6\\r\\n8\\r\\n9\\r\\n2\\r\\n4\\r\\n4\\r\\n9\\r\\n7\\r\\n']}, {'input': ['50\\r\\n1 4 10 6 8 5 3 7 3 2 9 4 5 11 11 5 11 10 2 1 2 4 1 2 10 4 2 1 3 8 3 3 5 11 7 7 9 6 6 3 6 10 5 1 11 10 2 1 4 9\\r\\n50\\r\\n26 27\\r\\n25 50\\r\\n2 44\\r\\n6 20\\r\\n1 17\\r\\n9 15\\r\\n6 10\\r\\n13 40\\r\\n4 9\\r\\n2 11\\r\\n4 11\\r\\n7 46\\r\\n2 3\\r\\n16 23\\r\\n2 28\\r\\n24 45\\r\\n25 32\\r\\n25 29\\r\\n8 9\\r\\n5 10\\r\\n6 20\\r\\n12 17\\r\\n19 38\\r\\n12 48\\r\\n8 32\\r\\n11 24\\r\\n13 21\\r\\n6 41\\r\\n16 28\\r\\n9 28\\r\\n42 47\\r\\n8 27\\r\\n1 4\\r\\n5 9\\r\\n2 44\\r\\n25 29\\r\\n25 43\\r\\n2 16\\r\\n33 35\\r\\n2 2\\r\\n7 21\\r\\n20 41\\r\\n20 30\\r\\n23 43\\r\\n20 27\\r\\n2 2\\r\\n1 34\\r\\n21 23\\r\\n19 19\\r\\n39 39\\r\\n'], 'output': ['2\\r\\n11\\r\\n11\\r\\n9\\r\\n11\\r\\n6\\r\\n4\\r\\n11\\r\\n5\\r\\n9\\r\\n7\\r\\n11\\r\\n2\\r\\n6\\r\\n11\\r\\n11\\r\\n6\\r\\n5\\r\\n2\\r\\n5\\r\\n9\\r\\n3\\r\\n11\\r\\n11\\r\\n10\\r\\n7\\r\\n5\\r\\n11\\r\\n6\\r\\n8\\r\\n5\\r\\n9\\r\\n4\\r\\n4\\r\\n11\\r\\n5\\r\\n11\\r\\n10\\r\\n3\\r\\n1\\r\\n9\\r\\n11\\r\\n6\\r\\n11\\r\\n4\\r\\n1\\r\\n11\\r\\n3\\r\\n1\\r\\n1\\r\\n']}, {'input': ['10\\r\\n1 2 3 1 2 3 1 1 1 100000\\r\\n5\\r\\n1 10\\r\\n2 9\\r\\n3 8\\r\\n1 7\\r\\n1 3\\r\\n'], 'output': ['4\\r\\n3\\r\\n3\\r\\n3\\r\\n3\\r\\n']}, {'input': ['1\\r\\n1\\r\\n1\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n']}, {'input': ['1\\r\\n100000\\r\\n5\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n1 1\\r\\n'], 'output': ['1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}]","id":163} {"description":"\u00c6sir - CHAOS \u00c6sir - V.\"Everything has been planned out. No more hidden concerns. The condition of Cytus is also perfect.The time right now...... 00:01:12......It's time.\"The emotion samples are now sufficient. After almost 3 years, it's time for Ivy to awake her bonded sister, Vanessa.The system inside A.R.C.'s Library core can be considered as an undirected graph with infinite number of processing nodes, numbered with all positive integers ($$$1, 2, 3, \\ldots$$$). The node with a number $$$x$$$ ($$$x > 1$$$), is directly connected with a node with number $$$\\frac{x}{f(x)}$$$, with $$$f(x)$$$ being the lowest prime divisor of $$$x$$$.Vanessa's mind is divided into $$$n$$$ fragments. Due to more than 500 years of coma, the fragments have been scattered: the $$$i$$$-th fragment is now located at the node with a number $$$k_i!$$$ (a factorial of $$$k_i$$$).To maximize the chance of successful awakening, Ivy decides to place the samples in a node $$$P$$$, so that the total length of paths from each fragment to $$$P$$$ is smallest possible. If there are multiple fragments located at the same node, the path from that node to $$$P$$$ needs to be counted multiple times.In the world of zeros and ones, such a requirement is very simple for Ivy. Not longer than a second later, she has already figured out such a node.But for a mere human like you, is this still possible?For simplicity, please answer the minimal sum of paths' lengths from every fragment to the emotion samples' assembly node $$$P$$$.","input_specification":"The first line contains an integer $$$n$$$ ($$$1 \\le n \\le 10^6$$$)\u00a0\u2014 number of fragments of Vanessa's mind. The second line contains $$$n$$$ integers: $$$k_1, k_2, \\ldots, k_n$$$ ($$$0 \\le k_i \\le 5000$$$), denoting the nodes where fragments of Vanessa's mind are located: the $$$i$$$-th fragment is at the node with a number $$$k_i!$$$.","output_specification":"Print a single integer, denoting the minimal sum of path from every fragment to the node with the emotion samples (a.k.a. node $$$P$$$). As a reminder, if there are multiple fragments at the same node, the distance from that node to $$$P$$$ needs to be counted multiple times as well.","notes":"NoteConsidering the first $$$24$$$ nodes of the system, the node network will look as follows (the nodes $$$1!$$$, $$$2!$$$, $$$3!$$$, $$$4!$$$ are drawn bold):For the first example, Ivy will place the emotion samples at the node $$$1$$$. From here: The distance from Vanessa's first fragment to the node $$$1$$$ is $$$1$$$. The distance from Vanessa's second fragment to the node $$$1$$$ is $$$0$$$. The distance from Vanessa's third fragment to the node $$$1$$$ is $$$4$$$. The total length is $$$5$$$.For the second example, the assembly node will be $$$6$$$. From here: The distance from Vanessa's first fragment to the node $$$6$$$ is $$$0$$$. The distance from Vanessa's second fragment to the node $$$6$$$ is $$$2$$$. The distance from Vanessa's third fragment to the node $$$6$$$ is $$$2$$$. The distance from Vanessa's fourth fragment to the node $$$6$$$ is again $$$2$$$. The total path length is $$$6$$$.","sample_inputs":["3\n2 1 4","4\n3 1 4 4","4\n3 1 4 1","5\n3 1 4 1 5"],"sample_outputs":["5","6","6","11"],"src_uid":"40002052843ca0357dbd3158b16d59f4","lang_cluster":"Python","difficulty":2700,"human_solution":"from sys import stdin, stdout\n\nprime = list()\nfactor = list()\ncount = list()\ndist = list()\nN = 0\n\ndef find_prime():\n global prime\n for i in range(2, 5010):\n is_prime = True\n for j in prime:\n if i % j == 0:\n is_prime = False\n break\n if is_prime is True:\n prime.append(i)\n\ndef calculate_factor(max):\n global prime\n global factor\n global dist\n factor = [[0 for x in range(len(prime))] for y in range(5010)] \n dist = [0] * (max+1)\n d = 0\n for i in range(1, max+1):\n temp = i\n factor[i] = list(factor[i-1])\n for j,x in enumerate(prime):\n while temp % x == 0:\n factor[i][j] +=1\n temp = temp \/ x\n d += 1\n if temp == 1:\n dist[i] = d \n break\n \ndef dynamic_count():\n global count\n for i in range (1,len(count)):\n count[i] += count[i-1]\n\ndef moving(i, left, right, d, current_factor):\n global count\n global prime\n global factor\n global N\n while (factor[left][i] == factor[right][i]):\n d += ((2 * (count[right] - count[left-1])) - N) * (factor[right][i] - current_factor[i])\n current_factor[i] = factor[right][i]\n i -= 1\n if i < 0:\n return d\n d += ((2 * (count[right] - count[left-1])) - N) * (factor[left][i] - current_factor[i])\n current_factor[i] = factor[left][i]\n \n \n temp_left = right\n while temp_left >= left:\n if (factor[temp_left-1][i] != factor[right][i] or temp_left == left ) and count[right] - count[temp_left-1] > int(N\/2):\n if (temp_left > left):\n d += ((2 * (count[temp_left-1] - count[left-1]))) * (factor[left][i] - current_factor[i]) \n return moving(i, temp_left, right, d, current_factor)\n elif factor[temp_left-1][i] != factor[right][i]:\n i -= 1\n right = temp_left - 1\n if i < 0:\n return d\n temp_left -= 1\n return d\n\ndef unanem():\n global prime\n global count\n global N\n \n if count[1] > int(N\/2):\n return 0\n current_factor = [0] * 5010\n if count[5000] - count[4998] > int(N\/2):\n return moving(len(prime)-3, 4999, 5000, 0, current_factor)\n for i,x in enumerate(prime):\n counter = 0\n if i == 0:\n counter = count[1]\n else:\n counter = count[prime[i] - 1] - count[prime[i-1] - 1]\n if counter>int(N\/2):\n return moving (i, prime[i-1], prime[i] - 1, 0 , current_factor)\n return 0\n\ndef main():\n global prime\n global factor\n global count\n global N\n global debugs\n N = int(stdin.readline())\n num_list = list(map(int, stdin.readline().split()))\n max = 0\n for i in num_list:\n if max < i:\n max = i\n \n \n count = [0] * (5010)\n for i in num_list:\n count[i] += 1\n \n find_prime()\n calculate_factor(max)\n dynamic_count()\n \n d = unanem()\n overall_dist = 0\n for i,c in enumerate(count):\n if i == max + 1:\n break\n if i == 0:\n continue\n overall_dist += (count[i] - count[i-1])*dist[i]\n print(overall_dist - d)\n \n\nmain()\n ","testcases":"[{'input': '3\\r\\n2 1 4\\r\\n', 'output': ['5']}, {'input': '4\\r\\n3 1 4 4\\r\\n', 'output': ['6']}, {'input': '4\\r\\n3 1 4 1\\r\\n', 'output': ['6']}, {'input': '5\\r\\n3 1 4 1 5\\r\\n', 'output': ['11']}, {'input': '11\\r\\n5000 5000 5000 5000 5000 5000 0 1 0 1 0\\r\\n', 'output': ['77835']}, {'input': '1\\r\\n0\\r\\n', 'output': ['0']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '4\\r\\n0 1 1 0\\r\\n', 'output': ['0']}, {'input': '17\\r\\n1 9 2 8 4 5 7 3 8 4 6 2 8 4 1 0 5\\r\\n', 'output': ['87']}, {'input': '4\\r\\n57 918 827 953\\r\\n', 'output': ['7835']}, {'input': '51\\r\\n17 26 14 0 41 18 40 14 29 25 5 23 46 20 8 14 12 27 8 38 9 42 17 16 31 2 5 45 16 35 37 1 46 27 27 16 20 38 11 48 11 3 23 40 10 46 31 47 32 49 17\\r\\n', 'output': ['2366']}, {'input': '95\\r\\n28 12 46 4 24 37 23 19 7 22 29 34 10 10 9 11 9 17 26 23 8 42 12 31 33 39 25 17 1 41 30 21 11 26 14 43 19 24 32 14 3 42 29 47 40 16 27 43 33 28 6 25 40 4 0 21 5 36 2 3 35 38 49 41 32 34 0 27 30 44 45 18 2 6 1 50 13 22 20 20 7 5 16 18 13 15 15 36 39 37 31 35 48 38 8\\r\\n', 'output': ['4286']}, {'input': '49\\r\\n27 12 48 48 9 10 29 50 48 48 48 48 11 14 18 27 48 48 48 48 1 48 33 48 27 48 48 48 12 16 48 48 22 48 48 36 31 32 31 48 50 43 20 48 48 48 48 48 16\\r\\n', 'output': ['3484']}, {'input': '17\\r\\n12 12 5 1 3 12 4 2 12 12 12 12 6 12 7 12 0\\r\\n', 'output': ['179']}, {'input': '70\\r\\n50 0 50 0 0 0 0 0 0 50 50 50 50 0 50 50 0 50 50 0 0 0 50 50 0 0 50 0 50 0 50 0 0 50 0 0 0 0 50 50 50 50 0 0 0 0 0 0 0 0 50 0 50 50 0 50 0 0 0 0 50 0 50 0 0 50 0 50 0 0\\r\\n', 'output': ['3024']}, {'input': '295060\\r\\n38 23 17 20 28 38 38 28 32 7 20 0 14 31 41 16 46 39 41 8 40 14 33 36 11 2 40 8 19 36 13 29 4 22 4 12 17 38 50 35 10 40 21 7 21 2 27 34 30 40 22 37 20 5 12 42 33 16 22 45 14 26 16 27 7 24 48 1 15 40 0 27 47 25 29 42 23 23 16 17 20 1 6 38 12 0 19 34 20 43 44 8 47 23 17 5 38 40 43 46 12 29 41 10 2 4 23 22 24 45 42 39 11 19 0 4 7 1 0 13 42 3 42 49 43 39 22 36 47 17 0 35 39 15 42 16 6 20 17 43 17 4 4 30 14 45 3 7 47 12 10 41 16 45 11 5 13 37 49 36 44 24 38 3 48 26 5 10 26 32 4 35 13 40 9 42 42 40 36 22 ...', 'output': ['14408680']}, {'input': '68484\\r\\n45 1 16 1 50 16 29 39 50 46 28 5 11 28 19 5 41 23 15 30 20 7 18 6 30 27 35 31 33 13 3 1 12 11 46 28 42 17 13 5 43 36 21 45 1 38 39 36 29 10 42 6 26 37 26 3 36 0 45 27 2 9 42 33 45 39 21 19 48 14 10 14 20 12 47 38 29 32 37 17 50 10 29 6 5 48 37 48 24 26 36 7 4 26 12 42 40 35 32 22 17 35 9 47 11 13 10 10 4 13 32 23 30 26 22 20 20 0 49 38 33 16 46 50 21 40 2 15 13 26 16 3 22 47 37 35 23 34 22 40 22 12 42 13 39 25 46 25 47 12 1 43 25 1 32 25 26 18 8 50 27 45 45 9 42 25 12 27 48 6 15 2 14 41 3 7 6 0 29 2...', 'output': ['3345881']}, {'input': '1000000\\r\\n3722 452 4276 30 137 3139 4268 4696 1846 2667 4961 3074 4236 4685 4087 2731 3444 4322 4932 2801 3270 3 1629 4477 3073 4958 3274 760 978 4270 3836 1343 4543 1770 2995 2073 3085 1190 4630 635 3582 1483 1953 990 4430 1546 1787 916 3572 2781 189 1832 2275 3122 714 931 4259 2670 241 3550 387 1032 3317 3802 1423 160 1717 1783 3911 4966 1947 4002 1905 2708 3798 4609 2264 399 4637 705 19 1194 1688 1682 1543 3335 521 4343 3036 3527 398 3205 444 1392 1226 3770 3775 4669 3394 3907 3857 4711 3696 2203 395 222...', 'output': ['7607420444']}, {'input': '1000000\\r\\n522 4027 3242 3953 143 2524 1807 4590 574 4082 4545 59 1875 3013 2181 906 2440 892 727 1900 57 480 1275 1115 4406 2958 4632 3920 1901 1611 1826 3199 2393 1268 1140 1549 3367 3625 4123 4996 4480 3553 1483 1236 3965 4973 4534 4546 2637 1999 1073 929 4043 1343 1310 850 188 1005 4228 2198 388 1001 2549 4137 212 3001 3231 1987 3806 2926 4746 355 1552 431 635 3372 1820 396 1425 3998 1362 3213 2589 4102 2081 761 438 409 902 4512 1274 520 1789 3499 414 2074 542 1784 1706 2436 199 1508 4900 1968 527 1815 3...', 'output': ['7605550222']}, {'input': '1000000\\r\\n2976 2807 1350 3599 2725 1350 2266 3745 1350 1350 1607 4715 1803 1350 1350 2355 1350 1350 1350 1350 1350 1350 3814 1008 2634 4272 153 1350 2335 1350 1350 2952 2395 1187 2912 1392 1350 208 1350 1350 2711 1350 4116 195 130 3661 2624 1350 1350 3561 1350 1350 1350 1350 1350 1350 1350 3830 4407 1056 1350 1350 3003 1212 1350 2702 1469 1483 1025 3345 1350 4493 1350 1350 1350 3324 1350 1350 1693 2153 1350 4035 1772 1350 1350 1350 1350 1469 2034 3780 1920 1050 1350 1350 1350 1921 4707 3667 1350 1350 1887 1...', 'output': ['5780430738']}, {'input': '1000000\\r\\n935 1374 1374 1834 1431 4393 1520 1678 1374 917 4059 1374 1374 1374 4957 1374 808 1374 1374 1374 1374 122 1374 1374 1374 3800 396 1374 1374 1374 1374 878 1374 648 1374 1374 1374 1374 2763 845 1374 1374 1374 1122 1374 1374 1374 1374 1374 1374 1374 1374 4696 1915 3392 1374 3781 1374 3861 4681 1864 1374 1374 2556 1978 1374 4166 1374 4140 1374 1374 4675 1436 1374 3101 1374 1374 83 1374 1374 4251 143 1374 4060 2303 1374 341 1374 1374 1374 1374 1374 269 1374 4575 1925 1374 1374 1374 3286 1374 3996 1374 ...', 'output': ['5811523118']}, {'input': '1000000\\r\\n0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 5000 5000 0 0 5000 0 5000 0 0 5000 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 5000 0 0...', 'output': ['1950296028']}, {'input': '1000000\\r\\n5000 0 5000 0 0 0 0 0 5000 0 0 5000 0 5000 0 0 0 5000 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 0 0 5000 0 0 5000 0 0 0 0 5000 5000 5000 0 0 5000 0 0 0 5000 5000 0 0 0 5000 5000 0 0 0 0 0 5000 0 5000 0 0 0 0 0 5000 5000 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 5000 0 0 0 0 5000 0 0 0 0 0 5000 5000 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 5000 5000 0 0 0 0 0 5000 5000 5000 5000 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 5000 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 5000 0 0 0 0 5000 5000 0 5000 ...', 'output': ['3888512064']}, {'input': '1000000\\r\\n0 0 5000 5000 5000 5000 5000 0 0 5000 5000 0 5000 0 0 0 0 0 0 5000 0 5000 5000 5000 5000 0 0 0 0 0 5000 5000 5000 5000 0 0 5000 5000 5000 5000 0 5000 5000 5000 0 5000 0 0 0 0 0 0 0 5000 5000 0 0 0 5000 0 5000 0 0 5000 0 5000 0 5000 5000 5000 0 5000 5000 0 5000 5000 0 5000 5000 0 0 0 5000 0 5000 5000 0 0 0 0 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000 0 5000 0 0 0 5000 0 5000 0 0 5000 0 0 0 5000 0 0 0 5000 0 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 0 0 5000 0 50...', 'output': ['7779561549']}, {'input': '1000000\\r\\n5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 0 5000 0 5000 5000 0 5000 5000 5000 5000 5000 0 0 5000 0 5000 5000 0 0 5000 5000 0 0 0 5000 5000 0 0 5000 5000 0 5000 5000 0 5000 5000 0 5000 5000 0 5000 0 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 0 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 0 0 5000 ...', 'output': ['3888449796']}, {'input': '1000000\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 0 0 5000 5000 0 0 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 500...', 'output': ['1947260463']}, {'input': '1000000\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 50...', 'output': ['0']}, {'input': '13\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 50\\r\\n', 'output': ['108']}, {'input': '45\\r\\n50 0 0 0 0 0 0 0 0 50 0 0 50 0 0 50 50 0 0 0 0 0 50 0 0 0 0 0 50 50 0 0 0 0 50 0 50 0 50 0 0 0 0 0 50\\r\\n', 'output': ['1296']}, {'input': '24\\r\\n50 0 50 50 50 0 50 50 0 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50\\r\\n', 'output': ['540']}, {'input': '68\\r\\n50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 0 0 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50\\r\\n', 'output': ['864']}, {'input': '75\\r\\n2597 1818 260 4655 4175 2874 2987 4569 2029 4314 444 2276 4937 1209 1797 4965 3526 275 3535 2198 4402 2144 1369 13 4453 1655 4456 711 3563 1650 3997 885 782 147 2426 974 2917 2100 4549 2465 3015 3485 3238 4086 171 3934 1903 133 2278 2573 688 551 872 459 2044 1401 2429 4933 3747 587 2781 4173 4651 4012 1407 2352 1461 566 2062 4599 1430 2269 3914 1820 4728\\r\\n', 'output': ['565559']}, {'input': '29\\r\\n8 27 14 21 6 20 2 11 3 19 10 16 0 25 18 4 23 17 15 26 28 1 13 5 9 22 12 7 24\\r\\n', 'output': ['692']}, {'input': '87\\r\\n1120 1120 1120 872 1120 731 3583 2815 4019 1291 4568 973 1120 1705 1120 822 203 1120 1120 1120 1120 4196 3166 4589 3030 1120 1120 1120 711 1120 500 1120 1120 3551 1120 1120 1120 1700 1120 1120 2319 4554 1120 1312 1120 1120 4176 1120 1120 3661 1120 1120 1120 1120 142 63 4125 1120 4698 3469 1829 567 1120 1120 1083 486 1120 1120 1120 1120 3763 1120 247 4496 454 1120 1120 1532 1120 4142 352 1120 359 2880 1120 1120 4494\\r\\n', 'output': ['438276']}, {'input': '27\\r\\n9 1144 1144 2 8 1144 12 0 1144 1144 7 3 1144 1144 11 10 1 1144 1144 5 1144 4 1144 1144 1144 1144 6\\r\\n', 'output': ['43222']}, {'input': '27\\r\\n0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 5000\\r\\n', 'output': ['62268']}, {'input': '59\\r\\n0 0 0 5000 0 0 0 5000 5000 0 5000 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 5000 0 5000 0 5000 0 0 5000 0 5000 0 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 5000 0 0 0 5000\\r\\n', 'output': ['233505']}, {'input': '80\\r\\n0 0 0 0 5000 0 0 5000 5000 5000 0 5000 0 5000 5000 0 0 0 0 5000 5000 0 0 5000 0 5000 5000 5000 0 5000 0 5000 5000 5000 0 0 5000 0 0 5000 5000 0 0 5000 0 5000 5000 5000 0 0 5000 5000 5000 0 0 5000 0 0 5000 0 5000 5000 0 5000 0 5000 0 5000 0 5000 0 0 0 0 5000 5000 5000 0 0 0\\r\\n', 'output': ['591546']}, {'input': '20\\r\\n0 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000\\r\\n', 'output': ['77835']}, {'input': '78\\r\\n0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 0 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000\\r\\n', 'output': ['249072']}, {'input': '3241\\r\\n20 31 49 20 24 6 33 50 24 30 6 50 45 34 43 40 35 10 27 4 43 19 42 16 20 49 20 32 18 41 36 32 26 37 9 21 29 16 22 27 9 48 47 29 30 15 43 24 26 20 3 11 4 35 12 42 48 11 44 46 31 44 20 47 0 7 7 18 47 3 18 8 4 9 2 48 28 22 32 4 24 37 32 26 49 12 4 10 44 50 41 23 5 26 1 5 34 4 1 13 39 26 24 25 25 9 37 5 22 15 12 49 48 2 28 37 42 44 45 30 4 41 43 7 44 39 9 21 47 41 7 17 18 14 19 13 35 8 36 39 1 18 47 25 48 22 44 41 12 17 5 5 44 48 9 4 49 37 34 9 13 37 21 40 45 13 3 32 22 12 25 48 24 6 28 9 41 2 45 28 31 9 ...', 'output': ['160831']}, {'input': '3569\\r\\n11 34 14 46 1 12 5 13 5 46 35 8 36 28 7 16 16 47 29 45 27 36 47 22 2 33 5 38 23 34 24 48 15 27 20 14 31 8 18 15 44 10 47 28 17 36 34 48 10 48 29 35 31 15 19 17 26 42 15 45 21 16 9 31 30 32 50 12 48 37 46 2 10 32 36 8 38 25 20 3 26 7 35 33 38 6 16 30 42 38 47 16 20 23 36 30 20 24 38 5 1 16 40 31 14 6 10 27 2 4 32 1 12 6 43 43 34 32 19 9 47 34 22 37 9 50 33 18 45 42 20 19 49 20 49 25 3 41 36 46 41 21 21 26 43 50 37 23 11 34 32 3 32 42 35 6 18 45 47 16 19 33 2 34 35 44 11 47 13 24 10 31 13 37 48 42 22 3...', 'output': ['174332']}, {'input': '5489\\r\\n2 18 8 33 36 26 20 18 26 0 26 42 26 5 10 26 26 26 26 2 26 0 28 26 26 26 26 26 28 30 25 24 26 2 26 26 39 26 26 26 26 31 26 26 26 46 26 5 26 26 45 16 26 7 26 26 26 26 49 26 26 1 0 8 26 19 3 18 8 38 26 14 40 31 44 26 26 26 26 26 30 42 26 10 26 18 29 32 8 29 3 26 26 26 6 26 26 6 26 26 26 34 26 26 4 10 0 47 49 26 26 26 1 18 29 12 23 2 39 50 4 17 26 29 8 26 13 35 26 16 42 30 26 26 46 6 42 26 26 26 5 24 26 26 46 29 26 35 26 26 26 23 26 26 26 26 26 26 26 26 26 26 26 26 50 33 26 31 26 26 47 26 26 26 26 6 26 2...', 'output': ['260842']}, {'input': '5817\\r\\n41 18 41 41 25 41 41 39 1 6 41 40 41 41 41 41 0 41 41 41 41 17 41 41 41 39 41 12 41 0 41 36 40 41 41 41 41 11 41 27 13 41 29 41 22 41 41 33 14 19 18 41 41 32 41 5 41 2 34 13 47 41 41 41 41 45 18 41 43 42 41 12 9 41 41 41 35 10 41 41 41 41 44 41 41 30 41 7 25 41 46 42 41 12 41 41 48 13 23 41 17 41 44 41 1 41 24 3 41 41 41 26 41 41 6 7 41 0 10 2 16 29 41 34 41 39 36 41 3 41 41 36 2 24 35 38 36 37 41 41 38 8 42 36 0 35 37 2 41 28 41 38 36 13 41 41 16 41 31 43 1 38 19 23 41 41 41 17 9 41 25 41 45 19 10 4...', 'output': ['377254']}, {'input': '2871\\r\\n0 0 0 0 0 50 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 50 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 0 0 0 50 0 0 0 50 0 0 0 50 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 50 0 0 50 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 ...', 'output': ['37260']}, {'input': '2543\\r\\n0 0 0 0 50 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 50 0 50 0 0 50 0 50 50 0 0 0 0 0 0 50 50 0 0 0 50 50 0 50 0 0 0 50 50 0 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 0 50 0 50 0 0 50 0 50 0 0 0 50 0 0 50 50 0 0 0 0 50 0 0 50 0 0 0 0 0 50 0 50 0 0 0 0 0 0 0 0 0 0 50 50 50 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 50 50 0 0 50 0 0 50 0 0 0 0 0 0 0 0 0 50 50 0 0 0 0 50 0 0 50 0 0 50 50 0 0 0 50 50 0 0 50 0 0 0 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 0 0 0 0 0...', 'output': ['66744']}, {'input': '6658\\r\\n50 50 50 0 0 50 0 0 50 0 0 50 50 0 50 50 0 0 50 50 0 50 50 50 50 0 50 0 0 50 50 0 50 0 0 0 0 0 50 0 0 0 50 0 50 50 50 50 0 50 0 50 50 50 50 50 50 50 0 0 50 0 0 50 0 50 0 0 50 50 50 0 0 0 0 0 50 0 0 0 50 0 0 0 50 0 50 0 50 50 50 50 0 0 50 50 0 50 50 0 0 0 50 50 0 0 50 50 0 0 0 50 0 0 50 50 50 50 50 0 0 0 0 50 50 50 50 0 0 0 0 0 0 0 50 0 50 50 50 0 0 0 50 0 50 50 50 50 50 0 0 50 50 0 0 0 0 50 0 50 0 50 50 0 0 0 50 50 0 50 50 50 0 50 0 0 0 0 0 50 50 50 0 50 0 0 0 0 0 0 50 50 0 0 50 50 0 50 50 0 50 50 0 ...', 'output': ['357156']}, {'input': '7782\\r\\n50 50 0 0 0 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 0 50 50 50 0 50 50 0 0 50 50 0 0 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 0 50 50 50 0 0 50 50 0 50 0 50 0 0 50 50 0 50 0 50 50 50 0 50 50 50 50 50 50 0 50 50 50 0 50 0 50 50 0 0 50 50 0 0 50 50 50 50 50 0 50 50 50 0 0 50 50 50 0 50 0 50 0 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 0 50 50 50 0 50 50 50 50 0 50 0 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 0 0 50 0 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 ...', 'output': ['202284']}, {'input': '8110\\r\\n0 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 0 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 0 50 5...', 'output': ['109080']}, {'input': '4463\\r\\n2612 1495 2859 1941 1446 2716 4690 4357 2841 4862 2243 3269 4454 995 3373 2249 4637 3365 2276 1330 3211 572 826 4368 2894 905 137 718 2081 3137 3718 4107 3420 1398 193 1255 504 325 879 3991 3579 4223 315 1854 418 1143 1822 4198 2589 1918 4633 1210 86 52 336 3709 2138 838 3815 866 595 3296 4810 699 234 2559 4523 349 3190 1770 267 987 489 2936 4000 907 4032 1122 293 1486 3054 4489 412 4844 3924 1750 1249 300 1593 2535 1028 1469 4747 4522 3000 1326 4214 2544 789 3632 2556 4190 2426 1185 2402 1880 3382 7...', 'output': ['33446396']}, {'input': '5587\\r\\n2623 467 1074 276 33 2358 829 2301 820 160 398 3363 4748 2942 4704 2516 1274 4663 634 4071 4825 143 2912 2888 2968 3925 3589 3793 3172 3541 3494 75 4914 342 2901 1959 45 4692 3580 1458 4080 3297 1947 2236 127 3280 3318 4024 1199 2520 4506 3727 4205 2762 4291 235 3535 2536 2526 2609 4920 2257 3986 2082 1471 2106 311 4015 3822 455 3335 2263 616 1187 464 390 1366 3124 4893 1719 4779 1197 2097 3292 1653 33 504 1596 1158 3852 3262 4875 428 854 1140 2848 3166 2498 1219 3806 556 4607 3368 421 1312 4387 4448...', 'output': ['38501618']}, {'input': '5915\\r\\n3291 884 4366 156 3584 3291 2124 2353 3291 3291 123 3989 805 3291 3291 3160 1562 3291 793 2707 3291 3291 3291 1504 3291 3291 891 3291 3291 3291 582 3291 3291 3291 3291 2333 715 4753 3291 3291 4111 4457 4577 3793 3291 3291 3291 1652 1916 3291 3882 251 912 4595 577 1650 3291 3291 3291 143 3506 1658 1944 3291 3291 3673 3291 3291 3291 646 3575 4523 3291 434 3291 1526 3291 3291 3853 4708 2083 3291 3291 2560 2032 825 3291 1770 3291 3291 2960 3291 1517 795 3291 3235 3601 2124 1798 3291 3291 1093 3291 3291 3...', 'output': ['51854645']}, {'input': '7039\\r\\n1790 834 1882 1790 1790 2803 2541 1790 3268 24 922 1790 1790 1790 2078 1790 939 1790 2717 1790 2404 1790 1790 1790 1480 1867 2257 3412 1790 1812 1790 1790 1790 3469 1790 2214 679 1919 3173 468 1790 1790 1790 2321 3045 1790 1790 1790 1329 1790 1790 1790 1790 1730 541 3140 1790 264 1604 2703 1790 1790 1790 2166 1790 1790 1790 1790 1790 949 1790 3427 1217 519 1790 1916 2692 1790 1199 2023 3315 1790 2503 1790 302 1790 1790 1790 1790 1790 2009 1790 1203 3040 1790 2836 1869 1790 1790 2613 1790 1790 2898 15...', 'output': ['37192065']}, {'input': '7716\\r\\n0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 5000 0 0 5000 0 0 0 0 0 0 5000 5000 5000 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 0 5000 0 0 0 0 5000 5000 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 5000 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['15317928']}, {'input': '6592\\r\\n0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 5000 0 0 0 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 5000 0 0 0 0 0 5000 5000 0 0 0 0 5000 0 0 5000 5000 0 0 5000 0 5000 0 0 0 5000 0 5000 0 0 0 0 0 5000 0 5000 0 0 5000 5000 0 0 0 0 0 0 0 0 5000 5000 5000 0 0 0 0 0 5000 0 0 0 0 5000 0 0 5000 0 0 0 5000 0 0 5000 5000 0 5000 0 0 0 0 5000 0 0 5000 0 0 0 0 5000 0 0 0 0 0 5000 5000 0 0 5000 0 0 0 5000 0 5000 0 0 5000 0 0 0 0 0 0 5000 0 0 0 5000 0 5000 5000 0 5000 5000 0 0 0 0 5000...', 'output': ['26993178']}, {'input': '6927\\r\\n5000 0 0 5000 5000 0 0 0 5000 5000 5000 0 0 0 0 5000 0 5000 5000 0 0 5000 5000 5000 0 5000 0 5000 0 0 5000 0 0 0 0 0 0 0 5000 0 5000 0 0 0 5000 5000 0 0 0 0 5000 5000 0 5000 5000 0 0 5000 5000 5000 0 0 0 5000 0 5000 5000 5000 0 5000 5000 0 0 5000 5000 0 0 0 5000 0 0 0 5000 0 0 5000 5000 0 5000 5000 5000 0 0 0 5000 5000 0 0 0 5000 0 0 5000 0 0 0 0 0 0 0 0 5000 0 0 5000 5000 0 0 0 0 5000 0 5000 5000 0 5000 0 0 5000 0 5000 0 5000 0 0 5000 5000 0 5000 5000 0 5000 0 5000 5000 0 5000 5000 5000 5000 0 0 500...', 'output': ['53675016']}, {'input': '8051\\r\\n5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 0 5000 5000 5000 0 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 5000 5000 5000 5000 5000 0 0 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 0 0 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 5000 0 0 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 ...', 'output': ['31865649']}, {'input': '8379\\r\\n5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 0 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 500...', 'output': ['16516587']}, {'input': '831909\\r\\n17 49 28 4 26 17 17 17 34 17 3 18 17 0 28 17 17 45 17 17 17 7 13 17 17 17 17 17 17 17 17 17 19 0 17 43 17 17 17 17 43 17 17 17 17 6 36 17 27 19 47 17 44 0 17 17 20 24 17 17 17 32 15 17 17 25 30 17 17 17 18 3 47 17 17 45 17 17 20 40 3 17 29 17 17 17 17 40 17 17 17 17 31 17 4 47 24 17 19 17 39 17 37 17 47 13 17 3 17 17 20 17 17 48 17 49 34 18 17 13 20 30 19 17 17 17 17 17 12 47 22 42 29 17 20 17 17 17 32 7 7 17 17 17 17 17 46 32 20 17 5 17 17 50 17 17 38 21 17 36 37 18 17 38 17 11 9 8 17 17 48 29 25 ...', 'output': ['31683596']}, {'input': '258037\\r\\n33 8 33 0 33 33 33 48 33 16 40 33 38 23 33 33 33 33 33 4 46 33 17 17 33 6 33 27 33 19 5 33 10 33 27 33 48 12 33 33 33 20 23 33 33 28 11 33 33 33 28 33 50 33 33 33 33 5 33 33 33 33 35 47 33 33 33 3 13 11 33 17 33 33 33 38 33 33 44 3 33 33 33 31 33 33 33 33 33 33 18 8 29 10 33 33 33 33 15 1 37 7 7 33 17 5 33 31 38 33 27 44 17 38 33 33 49 33 33 2 33 33 30 33 31 13 39 46 33 18 28 41 42 33 14 33 33 33 10 8 33 33 33 33 33 33 33 46 33 33 33 25 34 22 33 39 33 30 24 33 33 1 33 44 15 15 33 41 20 33 45 33 27 ...', 'output': ['14441842']}, {'input': '328921\\r\\n50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 50 0 0 50 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 50 0 50 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...', 'output': ['4404996']}, {'input': '555497\\r\\n0 0 0 0 0 50 50 0 0 0 50 0 0 0 50 0 0 0 50 50 0 0 0 0 0 0 50 0 0 50 50 50 50 50 50 0 0 50 50 0 50 50 0 0 50 0 0 0 0 50 50 0 0 0 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 50 0 50 50 0 0 0 0 0 0 50 50 0 0 0 0 0 50 0 0 0 0 0 50 0 50 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 50 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 50 0 50 0 0 0 0 0 0 50 0 50 0 0 0 0 50 0 0 0 50 0 50 0 50 0 0 50 0 50 0 0 0 0 50 0 0 50 50 0 0 0 0 0 50 0 0 0 ...', 'output': ['14931972']}, {'input': '207904\\r\\n50 50 50 0 0 50 0 50 50 50 0 50 50 50 0 50 50 50 50 0 50 0 0 0 50 0 0 0 50 0 0 50 0 50 0 0 0 50 50 0 50 50 50 0 50 0 0 0 0 50 0 50 50 0 50 0 0 0 50 50 50 50 50 50 50 50 50 0 0 50 50 0 50 50 50 50 0 0 0 0 0 50 50 50 0 0 50 0 50 0 50 0 0 0 50 0 50 0 0 50 0 50 50 50 50 50 0 0 50 0 50 0 0 50 50 0 50 0 50 0 0 0 50 0 0 50 0 0 0 0 0 50 0 50 0 50 0 50 0 0 50 50 50 50 50 0 0 0 50 0 50 50 50 50 50 0 50 50 0 0 50 0 50 0 0 0 50 0 50 50 50 0 0 50 0 50 50 50 0 0 0 0 50 50 0 0 50 50 50 50 50 50 50 0 0 0 50 50 50 ...', 'output': ['11221740']}, {'input': '971328\\r\\n50 0 0 0 50 50 0 50 50 50 50 50 50 50 0 50 50 50 50 0 50 50 50 0 50 50 50 50 0 50 50 50 50 0 50 50 50 50 50 50 50 50 0 0 50 50 0 50 50 50 0 0 0 50 50 50 50 50 0 0 50 50 0 0 50 50 0 50 50 50 0 0 50 50 50 0 50 0 50 0 50 50 0 50 0 50 0 50 50 0 50 50 50 50 0 50 50 50 50 50 50 50 50 0 50 50 50 0 0 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 50 50 50 0 50 0 50 0 0 50 0 50 50 0 0 50 50 50 50 50 50 50 0 50 0 50 50 0 0 0 0 50 50 0 50 50 0 50 50 50 50 50 50 50 50 ...', 'output': ['26290440']}, {'input': '744752\\r\\n50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 50 50 0 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 5...', 'output': ['10077264']}, {'input': '973217\\r\\n2233 4962 2835 1271 712 2124 3765 510 914 3364 2648 3399 744 3777 1516 739 3844 3879 261 863 2101 791 2276 1691 2145 1603 819 2340 415 3123 3260 1225 4746 4672 937 742 3927 25 2177 640 72 245 4053 3213 1322 3725 2842 883 216 4345 815 1534 633 4222 1677 2151 949 2691 2931 1897 1678 2599 4295 953 656 2864 2956 4134 4556 2839 3201 878 4447 270 1517 647 4010 3382 683 660 1393 785 3285 1115 1057 3672 3462 1434 882 122 505 3504 1946 1152 2997 3360 605 966 4034 4790 1344 1579 4482 2472 4484 3325 2852 543 ...', 'output': ['7404434821']}, {'input': '103937\\r\\n1662 2609 1161 2445 296 1285 3447 58 3521 1582 3524 1259 2360 3741 3130 4570 2215 3091 2032 3518 2969 3181 1414 1632 2101 4556 3642 1734 1388 4300 1631 182 1633 3970 1837 3967 1914 3162 915 2404 1208 4583 4334 279 747 2251 4671 4416 4752 3641 3811 1089 3213 740 1502 3880 2044 2766 777 3050 2475 4741 1121 2863 1065 4146 4872 2094 139 755 2780 4115 3442 2104 4030 1891 3037 2769 739 2274 3313 3098 2415 3909 4771 2761 1623 4084 3038 3130 4758 2667 3792 247 8 2846 3218 3485 3149 3845 470 4108 1031 484 3...', 'output': ['783928844']}, {'input': '520065\\r\\n756 4889 1279 756 756 756 756 4981 756 756 3514 3153 756 1559 563 3198 756 1696 756 1161 756 756 4853 1600 2623 3399 756 756 2736 756 756 756 756 756 4089 756 756 1407 3919 1546 1651 756 2430 756 756 756 756 756 756 4836 4582 1305 1304 763 756 4644 4890 756 3162 2611 3242 4455 1792 1882 756 2208 2014 4995 756 2947 2876 4738 756 756 1113 756 891 756 756 756 265 3619 756 756 756 4725 756 756 756 774 4476 4539 214 756 756 125 2452 3861 2363 2240 3842 756 4106 756 1183 756 756 756 756 756 1798 1694 793...', 'output': ['2532637708']}, {'input': '293489\\r\\n1084 4053 780 780 950 694 780 3823 780 780 2601 780 780 1469 3089 780 780 780 780 4707 780 2191 3268 2411 2892 171 3953 4307 340 1869 780 780 4373 4183 3523 780 2859 1053 780 1433 780 780 780 780 780 320 780 780 780 780 1948 2097 780 4234 780 780 780 4624 3124 780 780 3087 780 335 4642 780 780 2633 780 1447 780 780 4153 4532 780 780 3217 780 2340 2143 4089 2517 2085 780 2774 4590 3449 780 780 780 780 3715 4933 1026 2606 780 780 780 927 1997 3757 3730 780 780 780 780 780 4839 1369 780 602 780 1430 2...', 'output': ['1431772162']}, {'input': '546122\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 5000 5000 5000 5000 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0...', 'output': ['1063817646']}, {'input': '772698\\r\\n0 5000 0 5000 0 0 0 0 0 5000 5000 0 0 0 0 5000 0 5000 0 0 0 5000 0 0 0 0 0 0 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 5000 5000 0 5000 0 5000 0 0 0 0 5000 5000 0 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 5000 0 0 0 0 5000 0 5000 5000 0 0 0 5000 0 0 0 5000 0 5000 5000 0 0 0 5000 0 0 0 5000 0 0 5000 0 0 0 0 0 0 5000 0 5000 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 5000 0 0 0 0 0 0 0 0 0 0 0 0 5000 0 5000 5000 0 0 0 0 5000 0 0 0 5000 0 0 0 0 0 5000 0 0 5000 5000 0 5000 0 0 0 0 5000 0...', 'output': ['3012463572']}, {'input': '331312\\r\\n0 5000 0 5000 5000 5000 0 5000 5000 0 5000 5000 5000 0 0 0 0 0 5000 0 0 0 0 0 5000 5000 5000 5000 0 5000 0 5000 5000 0 5000 5000 5000 5000 0 0 5000 0 0 5000 0 5000 5000 0 0 0 5000 0 0 5000 0 5000 5000 0 0 0 5000 0 5000 5000 5000 0 0 5000 0 0 5000 5000 5000 5000 5000 0 5000 0 0 5000 0 5000 0 0 0 5000 5000 0 0 0 5000 5000 0 0 5000 0 5000 0 5000 0 0 0 0 0 5000 5000 5000 5000 0 5000 5000 0 0 5000 5000 0 0 5000 0 0 5000 0 0 5000 5000 5000 5000 5000 5000 0 0 5000 0 5000 0 0 0 0 0 0 5000 0 5000 5000 0 500...', 'output': ['2575933758']}, {'input': '104736\\r\\n0 5000 5000 5000 5000 0 5000 0 0 5000 0 0 5000 0 5000 5000 5000 5000 0 5000 0 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 0 5000 5000 0 5000 5000 0 0 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 0 0 0 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 ...', 'output': ['409458801']}, {'input': '868160\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 0 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 0 5000 5000 5000 5000 5000 5000 500...', 'output': ['1683384246']}, {'input': '652655\\r\\n3334 3647 3955 1615 3535 4170 4440 916 3449 2474 1705 3926 4990 3602 1931 3593 1063 1637 3035 3592 4867 1381 2636 4148 2037 3053 2672 4117 3999 3410 3987 3809 1214 2506 4227 1035 3947 2980 4434 4606 1941 506 2430 4660 4704 2335 3672 659 3575 4897 2110 3191 1255 4677 4945 1118 1910 2386 928 630 4433 1229 3359 4875 1579 912 3160 2739 967 2438 4642 2192 4582 4089 4592 4265 2103 1404 4987 2649 601 4729 1050 1838 3316 964 4887 3663 1072 1898 921 2139 1880 4576 4828 3720 4421 1337 2919 4725 573 4563 714 ...', 'output': ['5470312646']}, {'input': '426079\\r\\n2838 696 521 2882 1816 4549 1788 4865 847 828 3444 3010 3490 4211 1926 2653 1094 2830 1268 3453 4906 532 2632 1988 2018 3161 2738 4149 3293 3844 3397 4545 2797 920 2672 2489 3556 1906 4249 662 2529 3906 1460 2151 1230 2527 1916 1727 1206 1011 1446 2586 4323 999 3917 3068 2849 2543 4319 3752 3258 2376 3342 4053 1804 1481 4853 2579 1163 2305 1735 4229 4686 2331 1992 3311 3851 1731 2098 2361 4830 941 3025 1566 3201 1692 2927 1751 4691 1394 3965 3014 1311 3986 1112 1710 3773 555 2357 2535 1687 1859 276...', 'output': ['3563797440']}, {'input': '199503\\r\\n819 819 4407 819 2634 1942 1127 819 1841 2488 819 819 774 4506 4800 1081 599 3091 819 819 4720 3629 819 819 2127 819 1115 819 819 819 819 819 819 819 2505 4087 2733 819 819 819 4835 2398 819 1588 819 2857 3465 819 4081 4347 3965 3529 2022 819 819 2856 819 819 1121 1828 819 819 2151 1524 2595 819 819 819 3629 3952 819 819 819 819 855 819 819 819 4197 819 2830 1026 2311 2606 819 819 4789 1104 2866 819 819 4562 2823 819 819 819 4389 819 3175 819 1115 819 819 819 819 819 3432 3480 819 3975 2524 3140 81...', 'output': ['1068954149']}, {'input': '615631\\r\\n3009 3663 3663 3663 2397 2553 3747 2143 2156 2962 3663 3826 4164 3663 3663 1309 1934 3663 4312 1760 1737 4296 3663 4739 3663 3663 3663 3663 4846 3663 3663 3663 986 2467 3663 3663 3663 3663 3663 2818 3663 3663 3663 3663 3663 3372 3663 3663 3663 4656 3663 3663 4912 3720 3663 3663 3663 4085 3663 3663 3663 4188 1082 4132 4775 1118 3663 3561 1043 3663 2132 4242 4604 3663 3663 3663 3663 3663 3663 3476 3663 2419 3349 3663 3663 3663 1120 3663 3663 3663 3663 2097 3663 4132 3663 4381 4692 3349 3663 3663 2768...', 'output': ['6032856551']}, {'input': '201235\\r\\n501 501 501 501 5000 501 501 501 501 5000 5000 501 501 501 501 501 5000 501 501 501 501 501 501 5000 501 5000 501 501 501 5000 501 501 501 501 501 5000 5000 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 5000 5000 501 5000 501 5000 5000 501 501 501 501 501 5000 501 501 501 5000 501 501 501 5000 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 5000 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 5...', 'output': ['422388015']}, {'input': '427811\\r\\n501 5000 501 501 501 501 501 5000 501 5000 501 501 501 501 5000 501 501 5000 501 501 501 5000 501 501 5000 501 5000 501 501 501 501 5000 501 501 501 501 5000 501 501 5000 501 501 501 501 5000 5000 5000 501 501 501 501 501 501 501 501 501 501 5000 501 501 5000 501 501 5000 501 5000 501 5000 501 5000 501 501 5000 501 501 501 5000 501 501 5000 501 5000 501 501 501 5000 5000 5000 501 501 501 5000 5000 5000 5000 501 501 501 501 501 501 5000 5000 501 501 501 5000 501 501 501 5000 501 501 501 5000 501 500...', 'output': ['1809031255']}, {'input': '462860\\r\\n501 501 5000 5000 5000 5000 501 5000 501 501 5000 501 5000 501 5000 5000 501 5000 501 501 501 5000 5000 501 5000 501 5000 5000 501 501 501 501 5000 5000 5000 5000 5000 501 5000 501 5000 501 501 501 5000 501 5000 5000 501 5000 5000 501 5000 5000 5000 501 501 5000 5000 5000 501 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 501 501 501 5000 5000 501 5000 501 501 501 5000 501 501 501 501 5000 501 5000 5000 501 501 501 5000 501 501 5000 501 501 5000 501 501 501 5000 501 5000 501 50...', 'output': ['3916819805']}, {'input': '236284\\r\\n5000 501 5000 5000 501 5000 5000 5000 5000 5000 5000 501 5000 501 501 5000 501 5000 501 5000 501 501 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 501 5000 501 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 501 501 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 501 501 501 5000 5000 5000 501 5000 5000 5000 501 501 5000 5000 5000 5000 501 501 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 501 5000 5000 501 5...', 'output': ['1003533735']}, {'input': '999708\\r\\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 500...', 'output': ['2120768420']}, {'input': '1000000\\r\\n48 8 20 45 21 24 8 0 42 18 16 5 49 40 18 22 40 43 41 47 30 15 17 36 25 9 24 29 8 33 29 41 22 5 15 40 21 18 13 49 39 4 38 3 24 36 27 39 9 5 0 38 40 16 42 27 24 10 12 50 41 19 3 19 34 12 42 18 2 7 17 22 11 20 25 48 18 16 25 49 19 34 21 37 4 46 16 21 9 22 1 48 28 27 36 3 49 41 43 48 36 39 8 14 38 0 18 11 37 31 23 12 14 16 38 41 47 14 45 29 34 44 32 13 17 26 44 12 46 50 37 39 40 49 30 11 22 43 19 50 32 27 30 20 28 10 24 2 17 34 12 37 36 29 26 37 21 48 4 11 31 7 30 46 15 6 0 44 47 40 24 10 33 48 33 48 ...', 'output': ['48889749']}, {'input': '1000000\\r\\n14 46 0 25 40 23 14 44 34 31 11 45 22 44 30 13 12 10 5 13 50 46 12 44 18 45 16 11 34 6 37 3 46 18 18 42 42 5 39 24 4 7 35 2 24 24 48 7 44 30 41 44 26 38 41 13 20 23 41 40 48 41 24 2 2 45 47 32 17 44 8 47 46 3 31 2 12 6 34 38 49 41 35 9 40 5 46 24 4 5 30 18 21 15 29 32 49 50 8 40 44 34 24 32 36 34 32 14 18 22 29 4 4 11 31 0 25 28 47 27 17 15 32 9 5 19 45 36 33 44 47 14 18 42 33 40 19 5 25 26 32 6 0 27 37 15 25 49 49 2 35 50 2 13 45 31 15 18 22 28 36 32 5 39 44 41 17 38 1 25 18 17 48 40 3 3 31 29 19...', 'output': ['48862349']}, {'input': '1000000\\r\\n2 27 42 2 2 2 2 4 17 47 2 45 17 2 2 2 2 14 2 42 2 5 15 37 4 5 37 40 2 2 14 17 48 2 2 2 2 37 2 2 46 8 2 45 24 47 29 35 2 2 15 2 2 12 2 34 2 2 43 2 2 23 19 49 2 42 2 3 2 2 2 2 0 5 2 2 2 37 2 2 2 2 3 2 29 2 36 22 50 2 2 43 2 2 2 34 14 1 10 2 19 33 40 3 2 50 21 41 35 13 0 18 18 2 2 2 2 29 21 2 7 2 2 36 8 2 2 2 38 21 30 30 12 2 38 41 2 42 2 16 2 2 43 38 2 42 2 2 2 14 2 2 2 8 15 2 2 5 31 49 41 2 2 29 2 2 2 32 14 2 18 2 2 23 2 2 2 2 2 41 32 2 2 29 2 2 2 21 2 2 2 2 2 24 25 13 2 2 32 2 17 2 2 11 2 21 2 29 ...', 'output': ['24924286']}, {'input': '1000000\\r\\n32 18 30 28 18 36 18 16 18 8 19 18 43 18 18 18 18 18 46 16 18 15 18 4 31 20 26 6 18 14 18 0 18 14 18 17 38 5 30 41 50 18 47 31 18 1 18 18 18 7 18 19 18 12 2 8 26 18 18 18 0 18 17 18 18 18 36 18 44 18 18 18 18 18 18 45 18 43 18 28 37 18 18 18 18 18 5 18 24 18 18 18 18 5 15 19 18 49 18 3 18 18 47 39 18 19 18 2 18 18 32 18 48 31 18 18 12 18 14 28 5 10 5 18 18 46 18 18 18 42 18 9 18 3 18 18 18 7 35 16 18 18 18 18 10 18 18 39 18 41 33 30 10 18 24 18 34 32 18 15 3 15 18 18 1 34 22 18 41 17 18 10 18 18 1...', 'output': ['39529186']}, {'input': '1000000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 50 50 0 0 0 0 0 0 0 0 0 50 0 0 0 50 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 50 0 0 0 0 0 0 50 0 50 0 0 0 0 0 0 0 50 0 50 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 0 0 0 0 50 0...', 'output': ['13477752']}, {'input': '1000000\\r\\n0 50 0 0 50 0 50 0 0 50 0 0 50 0 0 50 50 0 50 0 0 0 50 50 0 0 50 50 50 0 0 0 0 0 0 0 0 0 0 50 0 50 0 50 0 0 0 0 50 0 0 50 50 0 0 0 0 0 0 50 50 0 50 0 0 0 0 0 0 50 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 50 0 50 0 50 0 0 0 0 0 50 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 50 0 50 50 0 0 0 0 50 50 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 50 0 0 0 50 50 0 0 50 0 50 0 0 0 0 0 50 0 0 0 0 0 0 50 0 0 50 50 0 0 50 0 0 0 0 0 50 0 0 50 0 50 50 0 0 0 50 50 50 0 50 50 0 0 50 0 0 0 50 0 0 50 0 0 0 0 0...', 'output': ['26977860']}, {'input': '1000000\\r\\n50 50 50 50 50 50 0 50 0 0 0 0 0 0 0 0 50 50 50 0 0 0 50 0 0 0 0 50 0 0 50 50 50 50 50 50 0 0 50 50 0 0 0 50 0 0 0 0 50 50 0 0 50 50 50 50 50 0 0 0 0 0 50 50 0 50 0 50 0 50 0 50 0 50 0 0 0 50 0 50 0 0 50 0 50 0 0 50 0 50 0 0 50 50 0 50 0 0 50 0 0 0 0 0 50 0 50 50 0 0 0 0 0 0 0 50 0 0 0 0 0 0 50 50 0 50 0 50 50 0 0 50 50 50 50 50 0 50 0 50 50 50 0 0 0 50 0 0 0 50 50 0 0 50 0 50 50 0 0 0 50 50 0 0 0 50 50 50 0 50 50 0 50 0 0 50 50 50 50 50 50 50 0 50 0 50 50 0 50 50 0 50 50 50 50 50 50 50 0 0 50 0 5...', 'output': ['53993952']}, {'input': '1000000\\r\\n50 50 0 50 50 50 50 0 50 50 0 50 50 50 0 0 0 50 50 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 50 0 0 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 0 50 0 50 50 50 50 50 50 50 0 50 0 50 0 0 0 50 50 0 50 0 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 50 0 50 50 50 50 0 0 50 50 50 0 50 50 50 50 0 50 50 50 0 0 50 50 50 50 50 5...', 'output': ['26987364']}, {'input': '1000000\\r\\n50 50 50 50 0 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 0 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 50 50 50 0 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 0 0 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 0 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 0 50 50 50 0 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 ...', 'output': ['13460904']}, {'input': '1000000\\r\\n4928 5000 4744 3545 3738 2132 1318 4951 2071 1952 2436 3340 2119 2695 4938 4493 4798 575 4969 3520 2191 2873 1960 4032 3857 4548 2212 3864 2948 3089 4829 1148 1656 4725 1963 2766 1319 1971 2937 2979 3194 1866 4461 1519 3195 704 2802 4208 4242 937 1797 2331 3923 801 1677 1718 3754 770 1402 1801 3480 1839 3134 1069 4671 4776 3159 1728 2554 2091 751 626 2234 1416 640 610 1634 4110 4476 1075 2240 3216 3739 4099 4694 925 2824 3432 4434 4320 3411 4658 1378 2193 4301 2762 3768 3874 3815 3882 2439 2911 45...', 'output': ['8384253798']}, {'input': '1000000\\r\\n4637 1302 2880 1973 4301 4845 2403 2820 3359 1121 1066 3885 1101 1911 2875 865 3402 3883 1943 2415 4562 693 1895 2528 2203 2858 3316 3183 3462 3194 1180 667 3088 1856 2257 684 4941 599 1784 4124 2997 729 4662 2207 1177 4995 2535 1128 2688 4949 989 2888 3918 2059 2028 1444 2432 4254 2685 1889 2049 2391 2534 2133 3021 3290 4710 3200 1581 1147 4271 2676 2283 598 1333 1733 3408 1993 2692 2252 4442 1469 3112 960 2265 1455 4820 2984 4120 4641 1432 3231 3896 960 1817 1911 3379 1879 1417 2363 4263 1442 30...', 'output': ['8374983176']}, {'input': '1000000\\r\\n1616 3742 1616 1616 1616 1616 1787 4057 1616 710 4642 3132 1616 1616 1280 1616 3392 1680 1616 1202 2794 1616 714 1036 1616 666 1616 1616 2066 1616 4643 1616 1616 2370 1393 4716 1616 1616 4295 960 2721 3010 1616 1616 1616 3783 1616 3737 2293 1921 2932 3666 4864 1616 1616 3161 1933 1616 2214 4578 1616 1616 2040 2520 1616 1616 4641 1616 1150 1616 1616 896 3297 1616 1616 1185 4532 1616 2888 1616 1616 1616 1246 1616 1616 1616 1616 4534 1616 1616 1753 1174 1616 940 1616 1616 1616 1616 3180 1616 737 2174...', 'output': ['6573578424']}, {'input': '1000000\\r\\n2691 1471 1769 1769 1769 2426 1769 1769 1769 1603 1769 1769 1769 1769 510 1567 1524 1666 1769 1769 1153 1769 1769 1769 2414 1769 1074 1769 3210 2644 1201 3796 1766 1769 1644 577 1769 1918 1855 1769 3024 1769 1769 2995 1769 1769 4565 1769 3576 864 1769 1769 3337 1769 1769 1945 4876 2367 704 1769 1769 3704 1769 3168 1769 2401 1769 2844 1769 4175 2420 4683 1769 1769 1769 3560 1769 1769 1769 1769 1769 2808 1769 4057 4544 1769 1769 2697 2150 1737 2724 1769 3524 1769 1769 3502 1769 1769 1769 1769 1620 2...', 'output': ['6808525559']}, {'input': '1000000\\r\\n501 501 5000 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 5000 501 501 5000 501 501 5000 501 501 501 501 501 501 501 501 501 501...', 'output': ['2113787080']}, {'input': '1000000\\r\\n501 5000 5000 501 501 501 5000 501 5000 501 501 501 501 5000 501 501 5000 501 501 5000 501 501 501 501 501 501 501 5000 501 501 501 5000 501 5000 5000 501 501 501 501 501 5000 5000 501 501 501 501 501 501 501 501 501 501 5000 5000 501 501 5000 5000 501 5000 5000 501 501 5000 501 501 501 501 501 501 5000 501 501 5000 501 501 501 501 501 501 501 501 501 501 501 501 501 5000 501 501 5000 501 501 5000 501 5000 501 501 5000 501 5000 501 501 5000 501 501 501 501 501 501 5000 5000 501 501 501 5000 501 50...', 'output': ['4241621565']}, {'input': '1000000\\r\\n5000 501 501 5000 501 501 5000 501 501 5000 5000 5000 5000 5000 5000 501 5000 5000 501 501 5000 501 5000 5000 501 5000 501 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 501 5000 501 501 5000 501 5000 5000 501 5000 5000 501 5000 501 5000 5000 5000 5000 5000 501 5000 5000 5000 501 501 501 5000 501 501 501 501 5000 5000 5000 501 5000 501 5000 5000 5000 501 5000 501 501 501 5000 5000 501 5000 501 5000 5000 5000 501 5000 501 501 5000 5000 5000 501 5000 501 5000 5000 501 ...', 'output': ['8464722245']}, {'input': '1000000\\r\\n5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 501 5000 5000 501 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 501 5000 501 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 501 501 5000 5000 5000 5000 5000 5000 501 501 5000 5000 501 5000 5000 501 5000 501 501 501 5000 5000 501 5000 5000 5000 501 5000 5000 501 5000 5000 501 501 5000 5000 5000 5000 5000 5000 5000 501 501 501 501 5000 501 5000 ...', 'output': ['4229505890']}, {'input': '1000000\\r\\n501 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 501 5000 5000 5000 5000 501 5000 5000 501 5000 5000 5000 5000 501 5000 5000 5000 5000 501 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 501 5000 5000 5000 501 5000 500...', 'output': ['2122852655']}, {'input': '1000000\\r\\n3491 3862 4899 1602 3307 2481 2146 1000 2479 2072 1534 2587 3924 4181 4835 2449 1976 4441 2217 3227 3297 2989 1754 1498 3742 1437 3766 3234 1072 3972 2514 1055 3883 4655 3452 1827 1874 1349 3202 2450 2946 3550 3879 3214 3123 2445 3893 1771 4218 3032 1325 4404 1421 1531 3754 1412 3178 4801 3290 4438 3677 4018 3175 1981 3353 3939 1512 3645 3759 3630 3769 3848 2031 1011 1771 1278 3021 2768 4761 1697 3561 4706 1464 3090 4827 1058 1120 3602 1808 2849 2244 4170 1928 3584 4395 2628 3674 1812 4074 1723 35...', 'output': ['8999391475']}, {'input': '1000000\\r\\n4525 1819 4273 3463 1648 2372 4978 2585 2374 2402 3570 2924 1135 1647 4411 924 1539 2671 1396 1592 2253 3152 2052 4858 4538 2952 1123 1441 2052 2404 2073 4052 4954 1331 4834 2353 1980 3243 4991 1389 2920 2050 1337 3188 2953 2753 2451 2119 3315 2174 3910 3759 3410 4935 2996 1728 1229 1070 1719 3715 2233 1699 3794 1656 4410 4356 3740 4240 4249 3772 2740 3670 3711 4863 1584 4255 1217 3831 4379 2230 2132 1625 3418 1469 4672 4632 1416 979 1173 3364 1419 1460 3118 3410 1250 1531 4916 3057 4448 4483 3900...', 'output': ['9003221879']}, {'input': '1000000\\r\\n1442 3254 3079 1274 4816 1653 3079 3079 3079 1396 4595 2894 3079 3079 1060 3079 4646 3079 3079 3567 3079 3079 3079 1111 2788 3079 913 3020 1455 3026 3079 3079 4799 3079 1018 3079 3079 3079 3079 2703 4596 3079 3079 3079 3079 3790 4649 3079 3079 3803 1425 3079 1956 3886 3861 3663 3079 3121 2774 2577 4524 3079 3079 1760 3079 3079 3545 3079 3079 3079 1009 3079 3775 4972 4066 3079 1602 3079 1288 3079 3079 3079 3079 3079 3079 1482 3079 3079 3079 3079 3079 2153 3079 1233 4758 1729 3079 1361 2370 3522 119...', 'output': ['9192195816']}, {'input': '1000000\\r\\n3085 4754 3064 4924 4924 3593 3916 3300 4924 2820 3819 4924 2825 2127 4924 3321 3323 4924 2612 4924 4924 4924 4924 4924 2572 4357 4924 4924 1690 4012 3790 4924 4924 4924 4924 2601 1049 4032 3940 4651 3530 4924 2765 2847 3710 2400 3405 2217 4924 4924 4546 1228 4924 4924 2806 4900 1510 4924 4924 4924 4924 3746 2527 4475 3412 4924 4924 4133 4924 4924 4924 3474 4924 4924 1006 4924 4924 1683 2651 2822 2382 2521 3814 4924 2554 4924 4215 3787 4685 2481 3981 4924 4924 3234 4112 4924 1758 4924 4924 4924 37...', 'output': ['12154389312']}, {'input': '4\\r\\n13 14 15 16\\r\\n', 'output': ['76']}, {'input': '3\\r\\n1 5 6\\r\\n', 'output': ['10']}, {'input': '3\\r\\n15 13 2\\r\\n', 'output': ['42']}, {'input': '3\\r\\n1 8 9\\r\\n', 'output': ['20']}, {'input': '3\\r\\n2 5 6\\r\\n', 'output': ['11']}]","id":164} {"description":"The only difference between easy and hard versions is constraints.Nauuo is a girl who loves random picture websites.One day she made a random picture website by herself which includes $$$n$$$ pictures.When Nauuo visits the website, she sees exactly one picture. The website does not display each picture with equal probability. The $$$i$$$-th picture has a non-negative weight $$$w_i$$$, and the probability of the $$$i$$$-th picture being displayed is $$$\\frac{w_i}{\\sum_{j=1}^nw_j}$$$. That is to say, the probability of a picture to be displayed is proportional to its weight.However, Nauuo discovered that some pictures she does not like were displayed too often. To solve this problem, she came up with a great idea: when she saw a picture she likes, she would add $$$1$$$ to its weight; otherwise, she would subtract $$$1$$$ from its weight.Nauuo will visit the website $$$m$$$ times. She wants to know the expected weight of each picture after all the $$$m$$$ visits modulo $$$998244353$$$. Can you help her?The expected weight of the $$$i$$$-th picture can be denoted by $$$\\frac {q_i} {p_i}$$$ where $$$\\gcd(p_i,q_i)=1$$$, you need to print an integer $$$r_i$$$ satisfying $$$0\\le r_i<998244353$$$ and $$$r_i\\cdot p_i\\equiv q_i\\pmod{998244353}$$$. It can be proved that such $$$r_i$$$ exists and is unique.","input_specification":"The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1\\le n\\le 2\\cdot 10^5$$$, $$$1\\le m\\le 3000$$$) \u2014 the number of pictures and the number of visits to the website. The second line contains $$$n$$$ integers $$$a_1,a_2,\\ldots,a_n$$$ ($$$a_i$$$ is either $$$0$$$ or $$$1$$$) \u2014 if $$$a_i=0$$$ , Nauuo does not like the $$$i$$$-th picture; otherwise Nauuo likes the $$$i$$$-th picture. It is guaranteed that there is at least one picture which Nauuo likes. The third line contains $$$n$$$ positive integers $$$w_1,w_2,\\ldots,w_n$$$ ($$$w_i \\geq 1$$$) \u2014 the initial weights of the pictures. It is guaranteed that the sum of all the initial weights does not exceed $$$998244352-m$$$.","output_specification":"The output contains $$$n$$$ integers $$$r_1,r_2,\\ldots,r_n$$$ \u2014 the expected weights modulo $$$998244353$$$.","notes":"NoteIn the first example, if the only visit shows the first picture with a probability of $$$\\frac 2 3$$$, the final weights are $$$(1,1)$$$; if the only visit shows the second picture with a probability of $$$\\frac1 3$$$, the final weights are $$$(2,2)$$$.So, both expected weights are $$$\\frac2 3\\cdot 1+\\frac 1 3\\cdot 2=\\frac4 3$$$ .Because $$$332748119\\cdot 3\\equiv 4\\pmod{998244353}$$$, you need to print $$$332748119$$$ instead of $$$\\frac4 3$$$ or $$$1.3333333333$$$.In the second example, there is only one picture which Nauuo likes, so every time Nauuo visits the website, $$$w_1$$$ will be increased by $$$1$$$.So, the expected weight is $$$1+2=3$$$.Nauuo is very naughty so she didn't give you any hint of the third example.","sample_inputs":["2 1\n0 1\n2 1","1 2\n1\n1","3 3\n0 1 1\n4 3 5"],"sample_outputs":["332748119\n332748119","3","160955686\n185138929\n974061117"],"src_uid":"ba9c136f84375cd317f0f8b53e3939c7","lang_cluster":"Python","difficulty":2600,"human_solution":"P = 998244353\nN, M = map(int, input().split())\nA = [int(a) for a in input().split()]\nB = [int(a) for a in input().split()]\nli = sum([A[i]*B[i] for i in range(N)])\ndi = sum([(A[i]^1)*B[i] for i in range(N)])\nX = [1]\nSU = li+di\nPO = [0] * (5*M+10)\nfor i in range(-M-5, 2*M+5):\n PO[i] = pow((SU+i)%P, P-2, P)\n\ndef calc(L):\n su = sum(L)\n pl = 0\n pd = 0\n RE = []\n for i in range(len(L)):\n a = li + i\n b = di - (len(L) - 1 - i)\n pd = b * L[i] * PO[a+b-SU]\n RE.append((pl+pd)%P)\n pl = a * L[i] * PO[a+b-SU]\n RE.append(pl%P)\n return RE\n\nfor i in range(M):\n X = calc(X)\nne = 0\npo = 0\nfor i in range(M+1):\n po = (po + X[i] * (li + i)) % P\n ne = (ne + X[i] * (di - M + i)) % P\ninvli = pow(li, P-2, P)\ninvdi = pow(di, P-2, P)\nfor i in range(N):\n print(po * B[i] * invli % P if A[i] else ne * B[i] * invdi % P)\n","testcases":"[{'input': '2 1\\r\\n0 1\\r\\n2 1\\r\\n', 'output': ['332748119\\r\\n332748119']}, {'input': '1 2\\r\\n1\\r\\n1\\r\\n', 'output': ['3']}, {'input': '3 3\\r\\n0 1 1\\r\\n4 3 5\\r\\n', 'output': ['160955686\\r\\n185138929\\r\\n974061117']}, {'input': '5 5\\r\\n0 1 0 0 1\\r\\n9 8 3 8 8\\r\\n', 'output': ['45170585\\r\\n105647559\\r\\n680553097\\r\\n483815788\\r\\n105647559']}, {'input': '10 10\\r\\n0 1 0 0 1 1 1 1 1 1\\r\\n12 18 6 18 7 2 9 18 1 9\\r\\n', 'output': ['199115375\\r\\n823101465\\r\\n598679864\\r\\n797795239\\r\\n486469073\\r\\n424203836\\r\\n910672909\\r\\n823101465\\r\\n212101918\\r\\n910672909']}, {'input': '20 20\\r\\n1 1 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 0 1\\r\\n1 13 7 11 17 15 19 18 14 11 15 1 12 4 5 16 14 11 18 9\\r\\n', 'output': ['688505688\\r\\n964619120\\r\\n826562404\\r\\n585852097\\r\\n851622699\\r\\n345141790\\r\\n104431483\\r\\n414170148\\r\\n349014804\\r\\n585852097\\r\\n516550769\\r\\n688505688\\r\\n13942874\\r\\n670143860\\r\\n447795381\\r\\n684086734\\r\\n654880455\\r\\n585852097\\r\\n20914311\\r\\n207085074']}, {'input': '30 50\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0\\r\\n1 2 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 1 2 1 1 2 1 2 2 1 1 2 2 2\\r\\n', 'output': ['346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n346646202\\r\\n542025302\\r\\n693292404\\r\\n346646202\\r\\n346646202\\r\\n693292404\\r\\n693292404\\r\\n693292404']}, {'input': '40 40\\r\\n1 1 1 1 0 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 1 1 1 1 1 1 1 1 1\\r\\n28 13 22 35 22 13 23 35 14 36 30 10 10 15 3 9 35 35 9 29 14 28 8 29 22 30 4 31 39 24 4 19 37 4 20 7 11 17 3 25\\r\\n', 'output': ['368107101\\r\\n848286965\\r\\n360530176\\r\\n210572788\\r\\n199380339\\r\\n848286965\\r\\n195418938\\r\\n210572788\\r\\n683175727\\r\\n45461550\\r\\n37884625\\r\\n544374860\\r\\n345376326\\r\\n518064489\\r\\n502910639\\r\\n510487564\\r\\n210572788\\r\\n210572788\\r\\n510487564\\r\\n202995863\\r\\n683175727\\r\\n526005255\\r\\n675598802\\r\\n202995863\\r\\n360530176\\r\\n37884625\\r\\n337799401\\r\\n871017740\\r\\n548372189\\r\\n30307700\\r\\n337799401\\r\\n855863890\\r\\n878594665\\r\\n337799401\\r\\n690752652\\r\\n840710040\\r\\n180265088\\r\\n187842013\\r\\n502910639\\r\\n863440815']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n13 18 27 40 3 1 20 11 25 11 2 31 22 15 36 12 11 24 8 39 31 36 19 24 10 39 27 4 10 22 14 3 25 5 24 19 20 33 17 19 30 15 37 33 3 27 26 29 37 34\\r\\n', 'output': ['30685719\\r\\n733580163\\r\\n601248068\\r\\n631933787\\r\\n621385537\\r\\n539876630\\r\\n815089070\\r\\n947421165\\r\\n519739161\\r\\n947421165\\r\\n81508907\\r\\n764265882\\r\\n896597977\\r\\n112194626\\r\\n468915973\\r\\n489053442\\r\\n947421165\\r\\n978106884\\r\\n326035628\\r\\n92057157\\r\\n764265882\\r\\n468915973\\r\\n275212440\\r\\n978106884\\r\\n407544535\\r\\n92057157\\r\\n601248068\\r\\n163017814\\r\\n407544535\\r\\n896597977\\r\\n570562349\\r\\n621385537\\r\\n519739161\\r\\n702894444\\r\\n978106884\\r\\n275212440\\r\\n815089070\\r\\n845774789\\r\\n193703533\\r\\n275212440\\r\\n224389252\\r\\n112194626\\r\\n10548250\\r\\n845774789\\r\\n621385537\\r\\n601248068\\r\\n61371438\\r\\n...']}, {'input': '50 50\\r\\n0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0\\r\\n2 50 37 21 21 2 26 49 15 44 8 27 30 28 26 40 26 45 41 37 27 34 8 35 2 23 2 49 13 1 39 37 12 42 7 11 4 50 42 21 27 50 28 31 17 22 10 43 46 13\\r\\n', 'output': ['380563607\\r\\n529890998\\r\\n551838435\\r\\n502062638\\r\\n635094670\\r\\n380563607\\r\\n954349479\\r\\n816391328\\r\\n358616170\\r\\n386444530\\r\\n907437062\\r\\n645509106\\r\\n717232340\\r\\n336668733\\r\\n954349479\\r\\n623561669\\r\\n954349479\\r\\n77604157\\r\\n314721296\\r\\n453480088\\r\\n645509106\\r\\n480115201\\r\\n907437062\\r\\n725742999\\r\\n380563607\\r\\n362831759\\r\\n725981442\\r\\n838731371\\r\\n976296916\\r\\n362990721\\r\\n932402042\\r\\n551838435\\r\\n286892936\\r\\n5880923\\r\\n832850448\\r\\n998164872\\r\\n761127214\\r\\n529890998\\r\\n5880923\\r\\n502062638\\r\\n645509106\\r\\n181137696\\r\\n181296658\\r\\n408391967\\r\\n739179777\\r\\n193222265\\r\\n904573682\\r...']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n1 2 2 1 2 2 2 1 1 1\\r\\n', 'output': ['665496237\\r\\n332748121\\r\\n332748121\\r\\n665496237\\r\\n332748121\\r\\n332748121\\r\\n332748121\\r\\n665496237\\r\\n665496237\\r\\n665496237']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 0 1 1\\r\\n2 1 2 2 1 1 1 1 1 1\\r\\n', 'output': ['771370640\\r\\n385685320\\r\\n771370640\\r\\n771370640\\r\\n385685320\\r\\n385685320\\r\\n385685320\\r\\n635246407\\r\\n385685320\\r\\n385685320']}, {'input': '10 10\\r\\n0 0 0 1 0 0 0 0 0 0\\r\\n2 2 2 2 2 2 2 1 2 2\\r\\n', 'output': ['973938381\\r\\n973938381\\r\\n973938381\\r\\n791643586\\r\\n973938381\\r\\n973938381\\r\\n973938381\\r\\n986091367\\r\\n973938381\\r\\n973938381']}, {'input': '10 10\\r\\n0 0 1 0 0 0 1 0 0 0\\r\\n2 1 2 1 1 2 1 1 1 1\\r\\n', 'output': ['44896189\\r\\n521570271\\r\\n482402083\\r\\n521570271\\r\\n521570271\\r\\n44896189\\r\\n740323218\\r\\n521570271\\r\\n521570271\\r\\n521570271']}, {'input': '10 10\\r\\n1 0 0 0 1 1 1 0 1 0\\r\\n1 2 1 2 1 1 2 2 2 1\\r\\n', 'output': ['910950063\\r\\n595918255\\r\\n797081304\\r\\n595918255\\r\\n910950063\\r\\n910950063\\r\\n823655773\\r\\n595918255\\r\\n823655773\\r\\n797081304']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n17 10 8 34 5 4 3 44 20 14\\r\\n', 'output': ['709444118\\r\\n6278277\\r\\n803618104\\r\\n420643883\\r\\n502261315\\r\\n401809052\\r\\n301356789\\r\\n426922160\\r\\n12556554\\r\\n408087329']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 0 1\\r\\n40 36 29 4 36 35 9 38 40 18\\r\\n', 'output': ['59109317\\r\\n951618303\\r\\n17898146\\r\\n105735367\\r\\n951618303\\r\\n675623373\\r\\n487465664\\r\\n505363810\\r\\n736385984\\r\\n974931328']}, {'input': '10 10\\r\\n0 0 0 0 0 0 0 1 0 0\\r\\n8 33 37 18 30 48 45 34 25 48\\r\\n', 'output': ['211347083\\r\\n497465085\\r\\n104016450\\r\\n725092025\\r\\n542990473\\r\\n269838145\\r\\n315363533\\r\\n227335634\\r\\n286118002\\r\\n269838145']}, {'input': '10 10\\r\\n0 0 1 0 0 0 0 0 1 0\\r\\n47 34 36 9 3 16 17 46 47 1\\r\\n', 'output': ['167709201\\r\\n57603825\\r\\n597597985\\r\\n690531016\\r\\n562925123\\r\\n673030499\\r\\n527924089\\r\\n312815611\\r\\n253346183\\r\\n853137943']}, {'input': '10 10\\r\\n1 0 0 1 1 0 1 0 0 1\\r\\n24 7 10 9 6 13 27 17 6 39\\r\\n', 'output': ['976715988\\r\\n573793375\\r\\n391885813\\r\\n865390672\\r\\n244178997\\r\\n209978251\\r\\n599683310\\r\\n965679188\\r\\n634429229\\r\\n89796951']}, {'input': '10 10\\r\\n0 0 0 0 0 1 0 0 0 0\\r\\n34 34 34 34 34 34 34 34 34 34\\r\\n', 'output': ['971203339\\r\\n971203339\\r\\n971203339\\r\\n971203339\\r\\n971203339\\r\\n754874965\\r\\n971203339\\r\\n971203339\\r\\n971203339\\r\\n971203339']}, {'input': '10 10\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n43 43 43 43 43 43 43 43 43 43\\r\\n', 'output': ['44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44\\r\\n44']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 2 2 2 1 1 2 1 1 1 2 1 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 1\\r\\n', 'output': ['260411572\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n260411572\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n260411572\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n260411572\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n520823144\\r\\n260411572']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1\\r\\n2 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 2 2 2 2 1 2 1 2 1 1 1 1 2 1\\r\\n', 'output': ['720162001\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n720162001\\r\\n720162001\\r\\n720162001\\r\\n859203177\\r\\n720162001\\r\\n859203177\\r\\n720162001\\r\\n427819009\\r\\n859203177\\r\\n859203177\\r\\n859203177\\r\\n720162001\\r\\n859203177']}, {'input': '30 30\\r\\n0 0 0 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\\r\\n2 1 1 2 1 2 2 2 2 2 1 1 2 2 2 1 2 2 2 1 2 1 1 1 1 1 2 1 1 1\\r\\n', 'output': ['188114875\\r\\n593179614\\r\\n593179614\\r\\n550614566\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n593179614']}, {'input': '30 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 1 1 1 2 1 2 2 1 2 1 2 1 1 2 2 1 2 1 2 1 2 2 2 1 1 2 1 2 2\\r\\n', 'output': ['593179614\\r\\n593179614\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n275307283\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n275307283\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875\\r\\n188114875\\r\\n593179614\\r\\n593179614\\r\\n188114875\\r\\n593179614\\r\\n188114875\\r\\n188114875']}, {'input': '30 30\\r\\n1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0\\r\\n1 1 1 2 2 1 2 1 2 1 1 2 2 2 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1\\r\\n', 'output': ['297674502\\r\\n297674502\\r\\n297674502\\r\\n101192689\\r\\n595349004\\r\\n549718521\\r\\n101192689\\r\\n297674502\\r\\n595349004\\r\\n297674502\\r\\n549718521\\r\\n101192689\\r\\n101192689\\r\\n101192689\\r\\n549718521\\r\\n595349004\\r\\n297674502\\r\\n549718521\\r\\n297674502\\r\\n549718521\\r\\n297674502\\r\\n101192689\\r\\n549718521\\r\\n595349004\\r\\n297674502\\r\\n101192689\\r\\n297674502\\r\\n101192689\\r\\n297674502\\r\\n549718521']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n23 45 44 49 17 36 32 26 40 8 36 11 5 19 41 16 7 38 23 40 13 16 24 44 22 13 1 2 32 31\\r\\n', 'output': ['42365832\\r\\n603712812\\r\\n124449607\\r\\n524276926\\r\\n161519661\\r\\n283321379\\r\\n362757265\\r\\n481911094\\r\\n203885493\\r\\n839372581\\r\\n283321379\\r\\n280673490\\r\\n399827319\\r\\n121801718\\r\\n683148698\\r\\n680500809\\r\\n360109376\\r\\n243603436\\r\\n42365832\\r\\n203885493\\r\\n240955547\\r\\n680500809\\r\\n521629037\\r\\n124449607\\r\\n561346980\\r\\n240955547\\r\\n479263205\\r\\n958526410\\r\\n362757265\\r\\n881738413']}, {'input': '30 30\\r\\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n41 39 15 34 45 27 18 7 48 33 46 11 24 16 35 43 7 31 26 17 30 15 5 9 29 20 21 37 3 7\\r\\n', 'output': ['61128841\\r\\n655563720\\r\\n98563838\\r\\n955457225\\r\\n295691514\\r\\n377063779\\r\\n916872088\\r\\n578393446\\r\\n115755411\\r\\n17191573\\r\\n235712813\\r\\n338478642\\r\\n556999882\\r\\n38585137\\r\\n895478524\\r\\n415648916\\r\\n578393446\\r\\n137148975\\r\\n437042480\\r\\n976850789\\r\\n197127676\\r\\n98563838\\r\\n698350848\\r\\n458436044\\r\\n257106377\\r\\n796914686\\r\\n736935985\\r\\n775521122\\r\\n818308250\\r\\n578393446']}, {'input': '30 30\\r\\n0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n29 38 18 19 46 28 12 5 46 17 31 20 24 33 9 6 47 2 2 41 34 2 50 5 47 10 40 21 49 28\\r\\n', 'output': ['528451192\\r\\n658031067\\r\\n259159750\\r\\n828137710\\r\\n218632982\\r\\n957717585\\r\\n838269402\\r\\n848401094\\r\\n218632982\\r\\n688426143\\r\\n942792071\\r\\n398871317\\r\\n678294451\\r\\n807874326\\r\\n129579875\\r\\n419134701\\r\\n787610942\\r\\n139711567\\r\\n139711567\\r\\n368476241\\r\\n378607933\\r\\n139711567\\r\\n498056116\\r\\n848401094\\r\\n787610942\\r\\n698557835\\r\\n797742634\\r\\n967849277\\r\\n927322509\\r\\n957717585']}, {'input': '30 30\\r\\n0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 12 9 1 5 32 38 25 34 31 27 43 13 38 48 40 5 42 20 45 1 4 35 38 1 44 31 42 8 37\\r\\n', 'output': ['399967190\\r\\n806628868\\r\\n604971651\\r\\n399967190\\r\\n3347244\\r\\n800038448\\r\\n225087925\\r\\n16736220\\r\\n621707871\\r\\n420050654\\r\\n816670600\\r\\n228435169\\r\\n208351705\\r\\n225087925\\r\\n231782413\\r\\n26777952\\r\\n3347244\\r\\n51806110\\r\\n13388976\\r\\n30125196\\r\\n399967190\\r\\n601624407\\r\\n23430708\\r\\n225087925\\r\\n399967190\\r\\n628402359\\r\\n420050654\\r\\n826712332\\r\\n205004461\\r\\n823365088']}, {'input': '30 30\\r\\n0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 1 1 0 0 0 1 1 1 1 0\\r\\n5 20 47 27 17 5 18 30 43 23 44 6 47 8 23 41 2 46 49 33 45 27 33 16 36 2 42 36 8 23\\r\\n', 'output': ['114252107\\r\\n760713694\\r\\n489959522\\r\\n18014766\\r\\n787754905\\r\\n689300600\\r\\n484993454\\r\\n142826188\\r\\n936763395\\r\\n126261951\\r\\n805769671\\r\\n827160720\\r\\n475023194\\r\\n781749983\\r\\n176049701\\r\\n138271795\\r\\n444998584\\r\\n252523902\\r\\n765679762\\r\\n354766165\\r\\n214239282\\r\\n727490181\\r\\n354766165\\r\\n565255613\\r\\n24019688\\r\\n275720240\\r\\n798903275\\r\\n969986908\\r\\n104636607\\r\\n126261951']}, {'input': '30 30\\r\\n0 0 0 0 0 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\\r\\n39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39\\r\\n', 'output': ['417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n417992317\\r\\n142843895']}, {'input': '30 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22\\r\\n', 'output': ['23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23\\r\\n23']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n2 1 1 2 2 1 2 1 1 2 2 2 1 2 2 1 1 1 2 1 2 1 2 2 2 1 2 1 1 2 2 2 2 2 1 2 2 2 2 2 2 1 2 1 2 2 2 1 1 2\\r\\n', 'output': ['714792256\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n357396128\\r\\n714792256\\r\\n714792256\\r\\n71479...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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\\r\\n1 1 1 2 1 1 1 1 1 2 1 1 1 2 2 2 1 1 1 1 2 2 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 2 2 2 1\\r\\n', 'output': ['964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n824636640\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n964858256\\r\\n931472159\\r\\n964858256\\r\\n931472159\\r\\n931472159\\r\\n964858256\\r\\n964858256\\r\\n93147...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0\\r\\n1 2 2 2 2 2 2 1 1 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 2 2 1 1 1 1 2 2 2 1 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 1\\r\\n', 'output': ['512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n512801870\\r\\n512801870\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n27359387\\r\\n96131098\\r\\n27359387\\r\\n27359387\\r\\n5128...']}, {'input': '50 50\\r\\n0 0 0 0 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 1\\r\\n2 1 1 1 1 2 2 2 1 1 2 2 2 1 2 1 2 2 2 1 1 1 1 2 2 1 1 1 1 2 1 2 2 2 2 1 1 1 2 1 2 1 1 2 2 1 1 2 2 1\\r\\n', 'output': ['303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n480354901\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n303976482\\r\\n151988241\\r\\n151988241\\r\\n303976482\\r\\n303976482\\r\\n151988241\\r\\n15198...']}, {'input': '50 50\\r\\n0 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 0 0 0\\r\\n1 1 1 1 1 2 2 1 1 2 2 2 1 1 1 2 2 2 1 1 1 1 2 1 1 1 2 2 1 1 1 2 2 1 1 2 1 1 2 2 2 2 2 2 2 2 2 1 2 1\\r\\n', 'output': ['525100120\\r\\n525100120\\r\\n392384920\\r\\n525100120\\r\\n525100120\\r\\n51955887\\r\\n784769840\\r\\n525100120\\r\\n392384920\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n392384920\\r\\n392384920\\r\\n525100120\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n392384920\\r\\n392384920\\r\\n392384920\\r\\n392384920\\r\\n784769840\\r\\n392384920\\r\\n525100120\\r\\n392384920\\r\\n51955887\\r\\n784769840\\r\\n525100120\\r\\n392384920\\r\\n525100120\\r\\n51955887\\r\\n51955887\\r\\n525100120\\r\\n392384920\\r\\n784769840\\r\\n525100120\\r\\n525100120\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n51955887\\r\\n784769840\\r\\n784769840\\r\\n51955887\\r\\n784769840\\r\\n51955887\\r\\n5251...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n32 22 24 45 22 17 10 5 27 1 48 15 14 43 11 16 38 31 24 19 5 28 2 4 34 29 18 32 47 11 2 34 39 29 36 11 39 24 23 16 41 45 17 39 30 15 16 3 3 8\\r\\n', 'output': ['118672439\\r\\n268758118\\r\\n837687594\\r\\n821980974\\r\\n268758118\\r\\n842923134\\r\\n848158674\\r\\n424079337\\r\\n692837455\\r\\n284464738\\r\\n677130835\\r\\n273993658\\r\\n987773273\\r\\n253051498\\r\\n134379059\\r\\n558458396\\r\\n827216514\\r\\n832452054\\r\\n837687594\\r\\n413608257\\r\\n424079337\\r\\n977302193\\r\\n568929476\\r\\n139614599\\r\\n687601915\\r\\n263522578\\r\\n129143519\\r\\n118672439\\r\\n392666097\\r\\n134379059\\r\\n568929476\\r\\n687601915\\r\\n113436899\\r\\n263522578\\r\\n258287038\\r\\n134379059\\r\\n113436899\\r\\n837687594\\r\\n553222856\\r\\n558458396\\r\\n682366375\\r\\n821980974\\r\\n842923134\\r\\n113436899\\r\\n547987316\\r\\n273993658\\r\\n55845...']}, {'input': '50 50\\r\\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n49 34 4 15 32 20 22 35 3 28 15 46 4 46 16 11 45 42 11 4 15 36 29 10 27 32 1 1 23 11 6 34 35 19 11 5 2 37 9 20 39 33 27 4 21 33 6 23 37 50\\r\\n', 'output': ['41887747\\r\\n858571128\\r\\n101008368\\r\\n378781380\\r\\n808066944\\r\\n505041840\\r\\n555546024\\r\\n883823220\\r\\n75756276\\r\\n707058576\\r\\n378781380\\r\\n163351879\\r\\n101008368\\r\\n163351879\\r\\n404033472\\r\\n277773012\\r\\n138099787\\r\\n62343511\\r\\n277773012\\r\\n101008368\\r\\n378781380\\r\\n909075312\\r\\n732310668\\r\\n252520920\\r\\n681806484\\r\\n808066944\\r\\n25252092\\r\\n25252092\\r\\n580798116\\r\\n277773012\\r\\n151512552\\r\\n858571128\\r\\n883823220\\r\\n479789748\\r\\n277773012\\r\\n126260460\\r\\n50504184\\r\\n934327404\\r\\n227268828\\r\\n505041840\\r\\n984831588\\r\\n833319036\\r\\n681806484\\r\\n101008368\\r\\n530293932\\r\\n833319036\\r\\n151512552\\r\\n...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 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\\r\\n12 29 36 24 44 22 38 43 30 19 15 2 39 8 13 50 29 18 37 19 32 39 42 41 20 11 14 25 4 35 14 23 17 29 1 19 3 6 8 31 26 46 9 31 36 49 21 38 17 27\\r\\n', 'output': ['820896192\\r\\n985588111\\r\\n466199870\\r\\n643548031\\r\\n15219645\\r\\n506731999\\r\\n603015902\\r\\n945055982\\r\\n986069299\\r\\n301507951\\r\\n27875887\\r\\n136816032\\r\\n671423918\\r\\n547264128\\r\\n889304208\\r\\n425667741\\r\\n985588111\\r\\n233099935\\r\\n534607886\\r\\n301507951\\r\\n192567806\\r\\n671423918\\r\\n876647966\\r\\n808239950\\r\\n369915967\\r\\n752488176\\r\\n957712224\\r\\n711956047\\r\\n273632064\\r\\n397791854\\r\\n957712224\\r\\n575140015\\r\\n164691919\\r\\n985588111\\r\\n68408016\\r\\n301507951\\r\\n205224048\\r\\n410448096\\r\\n547264128\\r\\n124159790\\r\\n780364063\\r\\n152035677\\r\\n615672144\\r\\n124159790\\r\\n466199870\\r\\n357259725\\r\\n43832398...']}, {'input': '50 50\\r\\n0 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 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n25 31 26 45 2 6 25 14 35 23 31 16 24 36 44 8 18 41 36 3 27 21 15 44 45 45 25 8 3 43 7 25 48 45 44 33 25 49 8 46 14 12 12 46 45 43 29 40 1 47\\r\\n', 'output': ['26673909\\r\\n312584066\\r\\n906195896\\r\\n646959648\\r\\n760799621\\r\\n285910157\\r\\n26673909\\r\\n334375582\\r\\n835938955\\r\\n264118641\\r\\n312584066\\r\\n96930850\\r\\n145396275\\r\\n717216589\\r\\n765682014\\r\\n48465425\\r\\n857730471\\r\\n123604759\\r\\n717216589\\r\\n642077255\\r\\n787473530\\r\\n501563373\\r\\n215653216\\r\\n765682014\\r\\n646959648\\r\\n108381283\\r\\n26673909\\r\\n48465425\\r\\n642077255\\r\\n884404380\\r\\n167187791\\r\\n26673909\\r\\n290792550\\r\\n646959648\\r\\n765682014\\r\\n75139334\\r\\n614792020\\r\\n172070184\\r\\n48465425\\r\\n528237282\\r\\n334375582\\r\\n571820314\\r\\n571820314\\r\\n528237282\\r\\n646959648\\r\\n884404380\\r\\n550028798\\r\\n242...']}, {'input': '50 50\\r\\n0 0 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0\\r\\n45 49 17 22 28 34 24 38 5 46 22 36 11 12 43 21 47 39 38 38 38 27 10 49 19 46 23 7 46 35 11 38 25 16 7 32 12 13 44 14 41 36 7 31 4 46 40 28 28 46\\r\\n', 'output': ['644620779\\r\\n102973792\\r\\n443172276\\r\\n267699221\\r\\n201448503\\r\\n886344552\\r\\n745782947\\r\\n99391617\\r\\n196964962\\r\\n259647944\\r\\n267699221\\r\\n619552244\\r\\n632971787\\r\\n371547745\\r\\n416322096\\r\\n28657358\\r\\n254279678\\r\\n338433480\\r\\n344697565\\r\\n344697565\\r\\n99391617\\r\\n464664183\\r\\n143249062\\r\\n102973792\\r\\n548817985\\r\\n15237815\\r\\n129823972\\r\\n675048688\\r\\n259647944\\r\\n380510381\\r\\n756520580\\r\\n344697565\\r\\n984824810\\r\\n829936749\\r\\n675048688\\r\\n658045869\\r\\n371547745\\r\\n112811160\\r\\n535398442\\r\\n599846428\\r\\n188023413\\r\\n619552244\\r\\n299923214\\r\\n44774351\\r\\n956167452\\r\\n259647944\\r\\n577475343\\r...']}, {'input': '50 50\\r\\n0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47 47\\r\\n', 'output': ['529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n988406960\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n529479959\\r\\n52947...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8\\r\\n', 'output': ['9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9\\r\\n9']}, {'input': '5 50\\r\\n1 1 1 1 1\\r\\n1 1 4 2 3\\r\\n', 'output': ['635246412\\r\\n635246412\\r\\n544496942\\r\\n272248471\\r\\n907494883']}, {'input': '10 50\\r\\n0 0 0 0 0 0 0 0 1 0\\r\\n3 1 3 3 1 3 1 2 2 1\\r\\n', 'output': ['187134581\\r\\n727874429\\r\\n187134581\\r\\n187134581\\r\\n727874429\\r\\n187134581\\r\\n727874429\\r\\n457504505\\r\\n124563167\\r\\n727874429']}, {'input': '20 50\\r\\n1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1\\r\\n1 2 2 1 2 2 2 2 2 2 1 1 2 2 2 1 1 1 2 2\\r\\n', 'output': ['853605709\\r\\n708967065\\r\\n708967065\\r\\n853605709\\r\\n708967065\\r\\n708967065\\r\\n708967065\\r\\n922030188\\r\\n708967065\\r\\n922030188\\r\\n853605709\\r\\n853605709\\r\\n708967065\\r\\n922030188\\r\\n708967065\\r\\n461015094\\r\\n853605709\\r\\n853605709\\r\\n708967065\\r\\n708967065']}, {'input': '20 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 2 2 2 2 2 2 1 2 1 2 1 2 1 1 2 1 2 2 1\\r\\n', 'output': ['436731907\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n436731907\\r\\n873463814\\r\\n436731907\\r\\n873463814\\r\\n873463814\\r\\n436731907']}, {'input': '40 50\\r\\n0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0\\r\\n33 26 4 19 42 43 19 32 13 23 19 1 18 43 43 43 19 31 4 25 28 23 33 37 36 23 5 12 18 32 34 1 21 22 34 35 37 16 41 39\\r\\n', 'output': ['729284231\\r\\n60340485\\r\\n239647233\\r\\n389641092\\r\\n20685064\\r\\n829280137\\r\\n389641092\\r\\n918933511\\r\\n529292419\\r\\n629288325\\r\\n366487398\\r\\n808595073\\r\\n579290372\\r\\n829280137\\r\\n829280137\\r\\n41331201\\r\\n389641092\\r\\n110338438\\r\\n239647233\\r\\n249989765\\r\\n679286278\\r\\n629288325\\r\\n426374038\\r\\n968931464\\r\\n160336391\\r\\n629288325\\r\\n49997953\\r\\n718941699\\r\\n579290372\\r\\n918933511\\r\\n539634951\\r\\n808595073\\r\\n89829960\\r\\n818937605\\r\\n539634951\\r\\n349985671\\r\\n968931464\\r\\n958588932\\r\\n210334344\\r\\n589632904']}, {'input': '41 50\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 2 4 2 3 2 4 3 1 1 3 1 3 2 5 3 3 5 4 4 1 1 2 3 2 1 5 5 5 4 2 2 2 1 2 4 4 5 2 1 4\\r\\n', 'output': ['394710173\\r\\n789420346\\r\\n580596339\\r\\n789420346\\r\\n185886166\\r\\n789420346\\r\\n580596339\\r\\n185886166\\r\\n394710173\\r\\n394710173\\r\\n185886166\\r\\n394710173\\r\\n581788048\\r\\n789420346\\r\\n636898629\\r\\n185886166\\r\\n185886166\\r\\n975306512\\r\\n580596339\\r\\n580596339\\r\\n394710173\\r\\n394710173\\r\\n55110581\\r\\n185886166\\r\\n55110581\\r\\n394710173\\r\\n975306512\\r\\n975306512\\r\\n975306512\\r\\n580596339\\r\\n789420346\\r\\n789420346\\r\\n789420346\\r\\n394710173\\r\\n789420346\\r\\n580596339\\r\\n580596339\\r\\n975306512\\r\\n789420346\\r\\n394710173\\r\\n580596339']}, {'input': '42 50\\r\\n0 1 0 0 0 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 1 0 0 0 0 0 0 0 1 0 0 0\\r\\n2 4 6 8 1 3 6 1 4 1 3 4 3 7 6 6 8 7 4 1 7 4 6 9 3 1 9 7 1 2 9 3 1 6 1 5 1 8 2 6 8 8\\r\\n', 'output': ['11284873\\r\\n329090227\\r\\n33854619\\r\\n45139492\\r\\n504764613\\r\\n995500935\\r\\n33854619\\r\\n504764613\\r\\n22569746\\r\\n504764613\\r\\n516049486\\r\\n22569746\\r\\n516049486\\r\\n538619232\\r\\n33854619\\r\\n33854619\\r\\n45139492\\r\\n538619232\\r\\n22569746\\r\\n504764613\\r\\n538619232\\r\\n22569746\\r\\n33854619\\r\\n549904105\\r\\n516049486\\r\\n504764613\\r\\n549904105\\r\\n538619232\\r\\n504764613\\r\\n11284873\\r\\n990014099\\r\\n516049486\\r\\n504764613\\r\\n33854619\\r\\n504764613\\r\\n527334359\\r\\n504764613\\r\\n45139492\\r\\n663667290\\r\\n33854619\\r\\n45139492\\r\\n45139492']}, {'input': '43 50\\r\\n1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n13 7 13 15 8 9 11 1 15 9 3 7 3 15 4 7 7 16 9 13 12 16 16 1 5 5 14 5 17 2 1 13 4 13 10 17 17 6 11 15 14 3 6\\r\\n', 'output': ['175780254\\r\\n94650906\\r\\n163530008\\r\\n802992688\\r\\n561362014\\r\\n881093354\\r\\n522311681\\r\\n319731340\\r\\n802992688\\r\\n881093354\\r\\n959194020\\r\\n241630674\\r\\n959194020\\r\\n802992688\\r\\n280681007\\r\\n241630674\\r\\n241630674\\r\\n124479675\\r\\n881093354\\r\\n163530008\\r\\n842043021\\r\\n124479675\\r\\n124479675\\r\\n13521558\\r\\n600412347\\r\\n600412347\\r\\n483261348\\r\\n67607790\\r\\n444211015\\r\\n639462680\\r\\n319731340\\r\\n163530008\\r\\n280681007\\r\\n163530008\\r\\n202580341\\r\\n444211015\\r\\n444211015\\r\\n920143687\\r\\n522311681\\r\\n802992688\\r\\n483261348\\r\\n959194020\\r\\n920143687']}, {'input': '44 50\\r\\n0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0\\r\\n2 6 6 11 2 4 11 10 5 15 15 20 20 7 9 8 17 4 16 19 12 16 12 13 2 11 20 2 6 10 2 18 7 5 18 10 15 6 11 9 7 5 17 11\\r\\n', 'output': ['327775237\\r\\n983325711\\r\\n983325711\\r\\n305397274\\r\\n327775237\\r\\n853173373\\r\\n305397274\\r\\n640631832\\r\\n320315916\\r\\n960947748\\r\\n960947748\\r\\n272889453\\r\\n283019311\\r\\n648091153\\r\\n975866390\\r\\n312856595\\r\\n290478632\\r\\n655550474\\r\\n625713190\\r\\n618253869\\r\\n968407069\\r\\n625713190\\r\\n968407069\\r\\n633172511\\r\\n327775237\\r\\n305397274\\r\\n283019311\\r\\n327775237\\r\\n983325711\\r\\n640631832\\r\\n327775237\\r\\n953488427\\r\\n648091153\\r\\n816905628\\r\\n953488427\\r\\n640631832\\r\\n960947748\\r\\n983325711\\r\\n305397274\\r\\n975866390\\r\\n648091153\\r\\n320315916\\r\\n290478632\\r\\n305397274']}, {'input': '45 50\\r\\n0 1 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 0\\r\\n4 4 23 23 13 23 9 16 4 18 20 15 21 24 22 20 22 1 15 7 10 17 20 6 15 7 4 10 16 7 14 9 13 17 10 14 22 23 3 5 20 11 4 24 24\\r\\n', 'output': ['630266647\\r\\n555616275\\r\\n379739073\\r\\n948743787\\r\\n301438985\\r\\n948743787\\r\\n669416691\\r\\n225976394\\r\\n555616275\\r\\n340589029\\r\\n156600176\\r\\n835755590\\r\\n563727926\\r\\n786866823\\r\\n560278630\\r\\n781592669\\r\\n970855676\\r\\n388465157\\r\\n835755590\\r\\n853405544\\r\\n889918511\\r\\n614441551\\r\\n156600176\\r\\n446277794\\r\\n117450132\\r\\n853405544\\r\\n630266647\\r\\n78300088\\r\\n225976394\\r\\n722767393\\r\\n708566735\\r\\n669416691\\r\\n58825276\\r\\n931705632\\r\\n78300088\\r\\n708566735\\r\\n970855676\\r\\n948743787\\r\\n223138897\\r\\n39150044\\r\\n781592669\\r\\n280139315\\r\\n555616275\\r\\n338964591\\r\\n786866823']}, {'input': '46 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n29 22 30 33 13 31 19 11 12 21 5 4 24 21 20 6 28 16 27 18 21 11 3 24 21 8 8 33 24 7 34 12 13 32 26 33 33 22 18 2 3 7 24 17 9 30\\r\\n', 'output': ['265429165\\r\\n98093399\\r\\n859759619\\r\\n646262275\\r\\n738585431\\r\\n455845720\\r\\n311590743\\r\\n548168876\\r\\n144254977\\r\\n502007298\\r\\n975163564\\r\\n380833110\\r\\n288509954\\r\\n502007298\\r\\n905921197\\r\\n571249665\\r\\n669343064\\r\\n525088087\\r\\n75012610\\r\\n715504642\\r\\n502007298\\r\\n548168876\\r\\n784747009\\r\\n288509954\\r\\n502007298\\r\\n761666220\\r\\n761666220\\r\\n646262275\\r\\n288509954\\r\\n167335766\\r\\n242348376\\r\\n144254977\\r\\n738585431\\r\\n51931821\\r\\n478926509\\r\\n646262275\\r\\n646262275\\r\\n98093399\\r\\n715504642\\r\\n190416555\\r\\n784747009\\r\\n167335766\\r\\n288509954\\r\\n121174188\\r\\n357752321\\r\\n859759619']}, {'input': '47 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n30 32 21 7 15 4 39 36 23 17 13 4 8 18 38 24 13 27 37 27 32 16 8 12 7 23 28 38 11 36 19 33 10 34 4 8 5 22 3 29 21 30 7 32 35 26 23\\r\\n', 'output': ['243227082\\r\\n658739962\\r\\n369907828\\r\\n456050727\\r\\n121613541\\r\\n831025760\\r\\n116546336\\r\\n491521369\\r\\n785420708\\r\\n537126421\\r\\n704345014\\r\\n831025760\\r\\n663807167\\r\\n744882861\\r\\n907034249\\r\\n993177148\\r\\n704345014\\r\\n618202115\\r\\n699277809\\r\\n618202115\\r\\n658739962\\r\\n329369981\\r\\n663807167\\r\\n496588574\\r\\n456050727\\r\\n785420708\\r\\n825958555\\r\\n907034249\\r\\n288832134\\r\\n491521369\\r\\n952639301\\r\\n866496402\\r\\n81075694\\r\\n76008489\\r\\n831025760\\r\\n663807167\\r\\n40537847\\r\\n577664268\\r\\n623269320\\r\\n35470642\\r\\n369907828\\r\\n243227082\\r\\n456050727\\r\\n658739962\\r\\n283764929\\r\\n410445675\\r\\n785420708...']}, {'input': '48 50\\r\\n1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 1\\r\\n9 42 15 12 2 9 41 13 23 14 17 42 25 10 10 2 38 36 41 31 9 20 31 41 20 41 40 28 7 37 14 25 23 38 27 17 6 40 2 19 19 3 8 32 13 22 41 20\\r\\n', 'output': ['386033769\\r\\n373559702\\r\\n643389615\\r\\n677156688\\r\\n85785282\\r\\n507867516\\r\\n317129978\\r\\n557604333\\r\\n299639299\\r\\n790016136\\r\\n959305308\\r\\n803246569\\r\\n74071672\\r\\n564297240\\r\\n564297240\\r\\n112859448\\r\\n631676005\\r\\n34981358\\r\\n760353928\\r\\n751077091\\r\\n386033769\\r\\n130350127\\r\\n751077091\\r\\n760353928\\r\\n130350127\\r\\n760353928\\r\\n717461287\\r\\n581787919\\r\\n395008068\\r\\n91411082\\r\\n790016136\\r\\n412498747\\r\\n299639299\\r\\n631676005\\r\\n159856954\\r\\n959305308\\r\\n338578344\\r\\n717461287\\r\\n112859448\\r\\n814960179\\r\\n73920403\\r\\n169289172\\r\\n451437792\\r\\n807506815\\r\\n733586412\\r\\n243209575\\r\\n317129978\\r...']}, {'input': '49 50\\r\\n0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0\\r\\n2 3 2 3 4 2 1 1 1 1 1 1 3 1 2 3 2 4 1 2 2 1 1 2 4 3 2 4 1 2 1 1 2 3 1 3 3 2 2 1 4 3 4 1 3 3 4 1 3\\r\\n', 'output': ['136570933\\r\\n703978576\\r\\n136570933\\r\\n703978576\\r\\n273141866\\r\\n136570933\\r\\n567407643\\r\\n478951804\\r\\n567407643\\r\\n567407643\\r\\n478951804\\r\\n478951804\\r\\n703978576\\r\\n567407643\\r\\n136570933\\r\\n703978576\\r\\n136570933\\r\\n273141866\\r\\n567407643\\r\\n136570933\\r\\n136570933\\r\\n567407643\\r\\n567407643\\r\\n136570933\\r\\n273141866\\r\\n703978576\\r\\n957903608\\r\\n273141866\\r\\n567407643\\r\\n136570933\\r\\n567407643\\r\\n567407643\\r\\n136570933\\r\\n703978576\\r\\n567407643\\r\\n438611059\\r\\n438611059\\r\\n136570933\\r\\n136570933\\r\\n478951804\\r\\n273141866\\r\\n703978576\\r\\n917562863\\r\\n478951804\\r\\n703978576\\r\\n703978576\\r\\n27314...']}, {'input': '50 50\\r\\n0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1\\r\\n1 9 24 8 8 11 21 11 8 5 16 32 31 15 29 14 16 20 5 18 5 10 31 23 21 4 4 20 20 11 1 4 4 15 9 14 5 30 13 16 32 27 19 10 19 24 21 1 21 15\\r\\n', 'output': ['475420905\\r\\n285810733\\r\\n429413837\\r\\n935878068\\r\\n808634181\\r\\n787710167\\r\\n1395475\\r\\n787710167\\r\\n808634181\\r\\n85801616\\r\\n619024009\\r\\n748779213\\r\\n762627113\\r\\n143603104\\r\\n896947114\\r\\n666426552\\r\\n619024009\\r\\n343206464\\r\\n380615819\\r\\n571621466\\r\\n380615819\\r\\n171603232\\r\\n132672278\\r\\n952237285\\r\\n1395475\\r\\n467939034\\r\\n467939034\\r\\n524218923\\r\\n343206464\\r\\n238408190\\r\\n616106935\\r\\n467939034\\r\\n467939034\\r\\n143603104\\r\\n285810733\\r\\n639542266\\r\\n85801616\\r\\n514809696\\r\\n23435331\\r\\n619024009\\r\\n748779213\\r\\n662977597\\r\\n725343882\\r\\n761231638\\r\\n48798018\\r\\n429413837\\r\\n959313399\\r\\n61...']}, {'input': '47 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39\\r\\n', 'output': ['573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n573459562\\r\\n57345...']}, {'input': '48 50\\r\\n1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 1\\r\\n42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42\\r\\n', 'output': ['612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n612040887\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n271232481\\r\\n27123...']}, {'input': '49 50\\r\\n0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 0\\r\\n4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4\\r\\n', 'output': ['371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n872512215\\r\\n872512215\\r\\n371008012\\r\\n371008012\\r\\n37100...']}, {'input': '50 50\\r\\n0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1\\r\\n33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33\\r\\n', 'output': ['677141055\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141057\\r\\n677141057\\r\\n677141057\\r\\n677141055\\r\\n677141055\\r\\n677141055\\r\\n67714...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n982795629\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n834950403\\r\\n83495...']}, {'input': '50 50\\r\\n1 0 1 0 0 1 1 1 0 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 0 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n996306346\\r\\n996306346\\r\\n996306344\\r\\n996306344\\r\\n99630...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n584830027\\r\\n70582...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2\\r\\n2']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 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\\r\\n25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25\\r\\n', 'output': ['382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n798399400\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n382995896\\r\\n38299...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 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\\r\\n25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25\\r\\n', 'output': ['459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n533798960\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n459085224\\r\\n45908...']}, {'input': '50 50\\r\\n0 0 0 0 0 0 0 0 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\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n273616393\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n311169062\\r\\n31116...']}, {'input': '50 50\\r\\n0 0 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0 0\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['123180764\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n123180764\\r\\n123180766\\r\\n123180764\\r\\n12318...']}, {'input': '50 50\\r\\n0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['80661140\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858868\\r\\n286858...']}, {'input': '50 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\\r\\n', 'output': ['51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51\\r\\n51']}, {'input': '5 5\\r\\n0 1 0 0 1\\r\\n2 4 1 2 1\\r\\n', 'output': ['665717847\\r\\n333191345\\r\\n831981100\\r\\n665717847\\r\\n831981101']}, {'input': '20 20\\r\\n0 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 1 1 1 0\\r\\n109 1 24 122 136 42 25 112 110 15 26 48 35 10 86 13 41 6 24 15\\r\\n', 'output': ['217595927\\r\\n149660176\\r\\n322657182\\r\\n290143118\\r\\n388896876\\r\\n296261274\\r\\n86540143\\r\\n507489163\\r\\n979723241\\r\\n248413934\\r\\n896431517\\r\\n195977977\\r\\n246884395\\r\\n633562669\\r\\n891842900\\r\\n947337935\\r\\n146601098\\r\\n897961056\\r\\n597111165\\r\\n451221827']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n2360379 9167688 488710 6896065 5243867 11762954 673012 1669264 265550 10921726 9383074 9523863 13429215 3223202 5372988 8197773 13052301 6045370 18630475 23534272 14923100 17181531 1112172 24623774 16991041 2363652 10720874 7171147 1261895 13127315 454592 1510882 12229327 15445105 15722482 5467131 92...', 'output': ['19790585\\r\\n929149870\\r\\n158142558\\r\\n415179791\\r\\n770973301\\r\\n197788614\\r\\n662208363\\r\\n968610058\\r\\n711622366\\r\\n89060603\\r\\n49510939\\r\\n593110743\\r\\n227455934\\r\\n197704062\\r\\n89005665\\r\\n237287745\\r\\n266986632\\r\\n365753331\\r\\n365877936\\r\\n464762563\\r\\n879788817\\r\\n148424226\\r\\n355820880\\r\\n830466826\\r\\n583301068\\r\\n553505420\\r\\n59407792\\r\\n988431747\\r\\n889537165\\r\\n425125094\\r\\n978481639\\r\\n494195332\\r\\n98957157\\r\\n850143163\\r\\n474568826\\r\\n889578801\\r\\n691943729\\r\\n751249179\\r\\n29723781\\r\\n385464681\\r\\n494219413\\r\\n968727719\\r\\n622687463\\r\\n929103141\\r\\n89090024\\r\\n563393484\\r\\n29714966\\r\\n484...']}, {'input': '1000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['652684471\\r\\n652684471\\r\\n959809060\\r\\n652684471\\r\\n307124589\\r\\n652684471\\r\\n652684471\\r\\n614249178\\r\\n307124589\\r\\n307124589\\r\\n307124589\\r\\n959809060\\r\\n652684471\\r\\n652684471\\r\\n959809060\\r\\n307124589\\r\\n307124589\\r\\n614249178\\r\\n652684471\\r\\n307124589\\r\\n652684471\\r\\n307124589\\r\\n307124589\\r\\n652684471\\r\\n268689296\\r\\n307124589\\r\\n959809060\\r\\n652684471\\r\\n307124589\\r\\n652684471\\r\\n614249178\\r\\n959809060\\r\\n652684471\\r\\n652684471\\r\\n307124589\\r\\n614249178\\r\\n307124589\\r\\n652684471\\r\\n652684471\\r\\n959809060\\r\\n307124589\\r\\n959809060\\r\\n307124589\\r\\n307124589\\r\\n959809060\\r\\n307124589\\r\\n95980...']}, {'input': '50000 1000\\r\\n1 0 0 1 0 0 0 1 1 1 0 1 0 1 1 0 1 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 1 0 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 1 0 0 0 1 1 0 1 0 0 1 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0...', 'output': ['512182090\\r\\n641172382\\r\\n697325018\\r\\n818311552\\r\\n590906119\\r\\n461103680\\r\\n370418391\\r\\n653972733\\r\\n766040380\\r\\n237657896\\r\\n893425807\\r\\n807372188\\r\\n964959592\\r\\n319396135\\r\\n111079234\\r\\n137994713\\r\\n9663504\\r\\n92358638\\r\\n965938119\\r\\n98687680\\r\\n675026792\\r\\n279244742\\r\\n15543727\\r\\n479206408\\r\\n519670811\\r\\n684652624\\r\\n777078382\\r\\n554151828\\r\\n865485075\\r\\n937290032\\r\\n565154228\\r\\n221807985\\r\\n218937300\\r\\n112386612\\r\\n310142313\\r\\n986922988\\r\\n267227503\\r\\n40988675\\r\\n369434552\\r\\n763776107\\r\\n694666611\\r\\n182771968\\r\\n494768207\\r\\n633944759\\r\\n635638470\\r\\n761724538\\r\\n162219074\\r\\n...']}, {'input': '200000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['967977965\\r\\n983111159\\r\\n952844771\\r\\n937711577\\r\\n937711577\\r\\n771246443\\r\\n483715757\\r\\n892311995\\r\\n967977965\\r\\n801512831\\r\\n846912413\\r\\n831779219\\r\\n967977965\\r\\n786379637\\r\\n892311995\\r\\n604781309\\r\\n710713667\\r\\n952844771\\r\\n952844771\\r\\n937711577\\r\\n874943312\\r\\n120519101\\r\\n892311995\\r\\n589648115\\r\\n619914503\\r\\n665314085\\r\\n374637533\\r\\n892311995\\r\\n937711577\\r\\n892311995\\r\\n650180891\\r\\n771246443\\r\\n922578383\\r\\n877178801\\r\\n483715757\\r\\n892311995\\r\\n952844771\\r\\n619914503\\r\\n574514921\\r\\n62834123\\r\\n907445189\\r\\n816646025\\r\\n846912413\\r\\n816646025\\r\\n937711577\\r\\n756113249\\r\\n846912...']}, {'input': '200000 3000\\r\\n0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 ...', 'output': ['568390992\\r\\n182388528\\r\\n352385861\\r\\n315979953\\r\\n743372559\\r\\n632628120\\r\\n995395434\\r\\n506334569\\r\\n667771666\\r\\n453192833\\r\\n680429762\\r\\n407446046\\r\\n471154985\\r\\n147648615\\r\\n936047905\\r\\n830053040\\r\\n251214636\\r\\n602162072\\r\\n263562703\\r\\n990790012\\r\\n150217484\\r\\n82075059\\r\\n932318671\\r\\n687474214\\r\\n345881774\\r\\n771937952\\r\\n356541287\\r\\n15233024\\r\\n811478946\\r\\n737405100\\r\\n892805310\\r\\n176354033\\r\\n997083988\\r\\n281716722\\r\\n628262667\\r\\n556117647\\r\\n359954433\\r\\n926451677\\r\\n992018326\\r\\n134736321\\r\\n139309832\\r\\n510415929\\r\\n125029199\\r\\n222157092\\r\\n859462710\\r\\n16077301\\r\\n83159806...']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 1 3 2 1 3 2 1 1 2 1 1 2 2 4 2 1 5 2 3\\r\\n', 'output': ['249561090\\r\\n249561090\\r\\n748683270\\r\\n499122180\\r\\n249561090\\r\\n748683270\\r\\n499122180\\r\\n249561090\\r\\n249561090\\r\\n499122180\\r\\n249561090\\r\\n249561090\\r\\n499122180\\r\\n499122180\\r\\n7\\r\\n499122180\\r\\n249561090\\r\\n249561097\\r\\n499122180\\r\\n748683270']}, {'input': '20 30\\r\\n1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n1 2 1 3 1 4 1 5 1 1 2 3 1 1 3 3 2 2 1 2\\r\\n', 'output': ['902255482\\r\\n806266611\\r\\n902255482\\r\\n710277740\\r\\n902255482\\r\\n537377994\\r\\n902255482\\r\\n518299998\\r\\n902255482\\r\\n902255482\\r\\n806266611\\r\\n710277740\\r\\n902255482\\r\\n902255482\\r\\n710277740\\r\\n710277740\\r\\n806266611\\r\\n806266611\\r\\n902255482\\r\\n806266611']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0\\r\\n3 4 1 2 1 1 1 2 5 2 1 2 3 1 1 2 3 2 1 2\\r\\n', 'output': ['441078046\\r\\n920852179\\r\\n479774133\\r\\n959548266\\r\\n479774133\\r\\n479774133\\r\\n479774133\\r\\n959548266\\r\\n402381959\\r\\n263018694\\r\\n479774133\\r\\n959548266\\r\\n441078046\\r\\n479774133\\r\\n479774133\\r\\n959548266\\r\\n441078046\\r\\n959548266\\r\\n479774133\\r\\n959548266']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0\\r\\n1 1 3 2 3 1 2 2 3 2 2 2 2 2 2 3 3 1 1 2\\r\\n', 'output': ['550803098\\r\\n550803098\\r\\n654164941\\r\\n103361843\\r\\n654164941\\r\\n550803098\\r\\n103361843\\r\\n103361843\\r\\n654164941\\r\\n103361843\\r\\n103361843\\r\\n103361843\\r\\n103361843\\r\\n103361843\\r\\n276551708\\r\\n654164941\\r\\n654164941\\r\\n138275854\\r\\n550803098\\r\\n103361843']}, {'input': '20 30\\r\\n0 0 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1\\r\\n1 2 2 2 2 2 1 1 2 1 4 1 2 5 3 4 1 1 2 1\\r\\n', 'output': ['297511613\\r\\n595023226\\r\\n756311680\\r\\n756311680\\r\\n756311680\\r\\n595023226\\r\\n297511613\\r\\n378155840\\r\\n595023226\\r\\n297511613\\r\\n514379007\\r\\n297511613\\r\\n595023226\\r\\n892534847\\r\\n136223167\\r\\n514379007\\r\\n378155840\\r\\n297511613\\r\\n595023226\\r\\n378155840']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n765 451 7275 385 1686 78 554 114 1980 394 776 232 627 760 782 7 486 32 1100 1516\\r\\n', 'output': ['491636110\\r\\n498623506\\r\\n486651408\\r\\n182179980\\r\\n6989399\\r\\n10980766\\r\\n871467875\\r\\n92836839\\r\\n509106603\\r\\n951327263\\r\\n211628580\\r\\n83852758\\r\\n11480438\\r\\n618912260\\r\\n58897200\\r\\n820057743\\r\\n605934809\\r\\n183676993\\r\\n948333237\\r\\n341401087']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1\\r\\n779 1317 1275 234 857 1531 785 265 679 767 1994 11 918 1146 1807 71 813 245 3926 580\\r\\n', 'output': ['552990868\\r\\n90431251\\r\\n712871250\\r\\n952916426\\r\\n537881559\\r\\n151361542\\r\\n321464532\\r\\n89445141\\r\\n86037605\\r\\n17799187\\r\\n586392419\\r\\n241031286\\r\\n40642277\\r\\n699465709\\r\\n481837969\\r\\n920500985\\r\\n572000768\\r\\n195703359\\r\\n903238702\\r\\n911489090']}, {'input': '20 30\\r\\n0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n128 574 205 490 611 1294 283 1690 1466 1896 272 19 1020 5032 357 1500 36 1749 1202 176\\r\\n', 'output': ['389864218\\r\\n157345415\\r\\n537589523\\r\\n962131647\\r\\n753565149\\r\\n104281847\\r\\n378440811\\r\\n873692367\\r\\n690552162\\r\\n658861420\\r\\n578900375\\r\\n198248582\\r\\n923070965\\r\\n228091231\\r\\n572635926\\r\\n887695253\\r\\n795942304\\r\\n70748620\\r\\n510359933\\r\\n785624388']}, {'input': '20 30\\r\\n1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0\\r\\n61 849 320 1007 624 441 1332 3939 1176 718 419 634 657 914 858 882 1019 1567 62 2521\\r\\n', 'output': ['514012356\\r\\n393871659\\r\\n166092575\\r\\n569465276\\r\\n74319433\\r\\n306884170\\r\\n254628439\\r\\n656312237\\r\\n485609669\\r\\n216694535\\r\\n825782618\\r\\n110704962\\r\\n294216114\\r\\n131255421\\r\\n733108087\\r\\n613768340\\r\\n14181299\\r\\n610566194\\r\\n624888021\\r\\n887363731']}, {'input': '20 30\\r\\n0 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 1 0 0 0\\r\\n244 1901 938 1350 1010 763 318 2158 1645 534 1356 563 295 1449 2306 224 1302 195 639 810\\r\\n', 'output': ['300071414\\r\\n595185476\\r\\n40756239\\r\\n113904636\\r\\n440148868\\r\\n947268885\\r\\n456535325\\r\\n542868956\\r\\n183161324\\r\\n427608407\\r\\n61171180\\r\\n375813928\\r\\n43680359\\r\\n55509680\\r\\n30410255\\r\\n360521133\\r\\n535772284\\r\\n722568686\\r\\n663107799\\r\\n390646234']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n126679203 179924771 16639504 67055540 14134870 36407782 15024189 39367944 121531542 5400023 5834434 8539193 3686913 11287136 36370086 71808281 138206490 59846864 19052959 21446598\\r\\n', 'output': ['615913610\\r\\n488825486\\r\\n773371096\\r\\n742795989\\r\\n193664548\\r\\n323188752\\r\\n32686082\\r\\n709701410\\r\\n293733249\\r\\n161181348\\r\\n193396792\\r\\n354491196\\r\\n708550409\\r\\n644392716\\r\\n323187536\\r\\n646345011\\r\\n487479735\\r\\n1930544\\r\\n322628919\\r\\n966734748']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1\\r\\n144831196 28660251 62050800 52660762 23189000 12771861 73096012 25119113 119648684 16011144 51600638 74708999 6312006 26945863 68746869 58112898 5070 19157938 74351320 60263898\\r\\n', 'output': ['132556548\\r\\n711988928\\r\\n6999755\\r\\n208709864\\r\\n320161276\\r\\n865416376\\r\\n320896979\\r\\n458941660\\r\\n671806481\\r\\n158009043\\r\\n351362956\\r\\n78248147\\r\\n927871852\\r\\n882014191\\r\\n988190329\\r\\n830735503\\r\\n1958329\\r\\n787106839\\r\\n942059547\\r\\n341315444']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0\\r\\n34095514 37349809 60555988 40280455 19504485 77297461 41415742 66290058 20631093 185280391 7151718 64927972 15611855 4317891 24600598 24588269 60808977 9108470 13217752 191209824\\r\\n', 'output': ['313283482\\r\\n21804622\\r\\n682197550\\r\\n361027027\\r\\n756362680\\r\\n151917509\\r\\n716108102\\r\\n131732975\\r\\n237068086\\r\\n731869119\\r\\n190595295\\r\\n847684643\\r\\n847454143\\r\\n501579235\\r\\n129856516\\r\\n246699402\\r\\n205385635\\r\\n639100445\\r\\n614421017\\r\\n227076269']}, {'input': '20 30\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0\\r\\n9380933 34450681 12329733 7732927 73910078 16165679 149467043 56914401 21809098 36934833 71019254 168559440 12033996 40465391 7156881 3312348 37150678 130625432 42709585 66115911\\r\\n', 'output': ['813231583\\r\\n458087744\\r\\n445793615\\r\\n651101155\\r\\n484645642\\r\\n506668954\\r\\n896602699\\r\\n556862659\\r\\n145127201\\r\\n302005399\\r\\n558418033\\r\\n213871822\\r\\n57299634\\r\\n564466143\\r\\n767349204\\r\\n290138481\\r\\n12657688\\r\\n925337836\\r\\n827843024\\r\\n119362169']}, {'input': '20 30\\r\\n0 0 1 0 1 0 1 1 1 0 1 1 0 0 1 0 0 1 0 1\\r\\n66166717 200301718 6725634 95379617 42880832 48874211 64912554 36809296 13248978 58406666 53142218 45080678 19902257 58554006 23570140 14484661 7589423 78746789 11072716 52395211\\r\\n', 'output': ['823107880\\r\\n742699237\\r\\n987770596\\r\\n549924308\\r\\n730188349\\r\\n913535291\\r\\n936423447\\r\\n122869154\\r\\n581668441\\r\\n749452306\\r\\n615454312\\r\\n176148736\\r\\n874336841\\r\\n897418997\\r\\n235568492\\r\\n24727530\\r\\n143875067\\r\\n15270097\\r\\n200154604\\r\\n356406452']}, {'input': '20 30\\r\\n0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661 26210661\\r\\n', 'output': ['76898501\\r\\n989279651\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501\\r\\n76898501']}, {'input': '20 30\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803 5766803\\r\\n', 'output': ['504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981\\r\\n504888981']}, {'input': '2000 300\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...', 'output': ['527557309\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n819771096\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n762900831\\r\\n762900831\\r\\n292213787\\r\\n762900831\\r\\n527557309\\r\\n292213787\\r\\n762900831\\r\\n292213787\\r\\n527557309\\r\\n762900831\\r\\n292213787\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n819771096\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n292213787\\r\\n762900831\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n527557309\\r\\n762900831\\r\\n762900831\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n762900831\\r\\n527557309\\r\\n76290...', '126026410\\r\\n26532090\\r\\n89545496\\r\\n348227668\\r\\n407921745\\r\\n822476105\\r\\n815841057\\r\\n129343473\\r\\n683184486\\r\\n182403525\\r\\n971714643\\r\\n669922973\\r\\n195669656\\r\\n643389211\\r\\n596958847\\r\\n991612114\\r\\n26531426\\r\\n494147799\\r\\n587007825\\r\\n646703323\\r\\n192353616\\r\\n198987665\\r\\n116075186\\r\\n208935334\\r\\n451035127\\r\\n991612774\\r\\n630129722\\r\\n673238446\\r\\n965081504\\r\\n404604334\\r\\n762781111\\r\\n945182265\\r\\n613540647\\r\\n855640163\\r\\n540577710\\r\\n739563385\\r\\n185720640\\r\\n13265829\\r\\n460984258\\r\\n182404969\\r\\n988297561\\r\\n726301539\\r\\n301795019\\r\\n46434122\\r\\n882170987\\r\\n533948601\\r\\n729615799\\r...', '257947573\\r\\n350833899\\r\\n998147431\\r\\n282054341\\r\\n689337877\\r\\n802790225\\r\\n636332064\\r\\n611526839\\r\\n405886622\\r\\n295781176\\r\\n577883978\\r\\n211877869\\r\\n476761551\\r\\n471920813\\r\\n313000296\\r\\n8886097\\r\\n165109708\\r\\n231143899\\r\\n91489412\\r\\n972042214\\r\\n584771626\\r\\n771892731\\r\\n841370746\\r\\n736106038\\r\\n702414716\\r\\n368751476\\r\\n510452873\\r\\n253155296\\r\\n619859862\\r\\n14376831\\r\\n37833603\\r\\n94933236\\r\\n485696109\\r\\n96233228\\r\\n33691322\\r\\n403791251\\r\\n233190809\\r\\n447164049\\r\\n173248887\\r\\n549683390\\r\\n863382143\\r\\n717538465\\r\\n704413165\\r\\n210480955\\r\\n414122723\\r\\n922528686\\r\\n131321464\\r\\n40...', '723727157\\r\\n723727157\\r\\n898419922\\r\\n449209961\\r\\n898419922\\r\\n174692765\\r\\n723727157\\r\\n723727157\\r\\n723727157\\r\\n449209961\\r\\n449209961\\r\\n174692765\\r\\n723727157\\r\\n174692765\\r\\n723727157\\r\\n723727157\\r\\n623902726\\r\\n723727157\\r\\n723727157\\r\\n449209961\\r\\n723727157\\r\\n449209961\\r\\n449209961\\r\\n174692765\\r\\n723727157\\r\\n449209961\\r\\n349385530\\r\\n449209961\\r\\n449209961\\r\\n449209961\\r\\n449209961\\r\\n723727157\\r\\n449209961\\r\\n449209961\\r\\n449209961\\r\\n623902726\\r\\n449209961\\r\\n449209961\\r\\n898419922\\r\\n898419922\\r\\n723727157\\r\\n449209961\\r\\n723727157\\r\\n723727157\\r\\n723727157\\r\\n174692765\\r\\n17469...', '449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n449543865\\r\\n44954...', '228892698\\r\\n323233274\\r\\n31331450\\r\\n583630535\\r\\n530020844\\r\\n200867506\\r\\n762566026\\r\\n461091654\\r\\n900597519\\r\\n687197433\\r\\n232025843\\r\\n294169404\\r\\n557699810\\r\\n988325579\\r\\n966739790\\r\\n633933968\\r\\n156657250\\r\\n762046687\\r\\n338898999\\r\\n134379009\\r\\n458304735\\r\\n975792999\\r\\n343970609\\r\\n589896825\\r\\n188161813\\r\\n733675269\\r\\n708610109\\r\\n303222613\\r\\n919742615\\r\\n718701996\\r\\n235158988\\r\\n5746951\\r\\n831841442\\r\\n194601216\\r\\n389029319\\r\\n946729129\\r\\n65449819\\r\\n768486090\\r\\n213226973\\r\\n847160941\\r\\n853773457\\r\\n913476325\\r\\n847334054\\r\\n435334042\\r\\n997551901\\r\\n781018670\\r\\n847334054...', '280562572\\r\\n27981324\\r\\n930424996\\r\\n580126064\\r\\n653672085\\r\\n638998124\\r\\n192370181\\r\\n304975360\\r\\n268606553\\r\\n887998181\\r\\n902057157\\r\\n419880164\\r\\n965999027\\r\\n37849969\\r\\n655704617\\r\\n915939588\\r\\n290316653\\r\\n133632797\\r\\n916310849\\r\\n291352554\\r\\n315435621\\r\\n753760137\\r\\n617080324\\r\\n863678858\\r\\n719694519\\r\\n658038314\\r\\n750307459\\r\\n915589744\\r\\n530437886\\r\\n512060713\\r\\n157922588\\r\\n178644172\\r\\n5715303\\r\\n194942404\\r\\n852097346\\r\\n696406228\\r\\n891303846\\r\\n489183600\\r\\n892182349\\r\\n437838373\\r\\n390449491\\r\\n931412865\\r\\n520118475\\r\\n724052962\\r\\n624309238\\r\\n315358057\\r\\n157108994...']}, {'input': '2000 300\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...', 'output': ['510770111\\r\\n586552453\\r\\n521518610\\r\\n729496815\\r\\n925336870\\r\\n218501419\\r\\n210003823\\r\\n721775463\\r\\n410294316\\r\\n59753754\\r\\n445916833\\r\\n149785626\\r\\n397166471\\r\\n850878761\\r\\n322612228\\r\\n400512598\\r\\n962933991\\r\\n238352988\\r\\n481795882\\r\\n312429269\\r\\n230724223\\r\\n668360989\\r\\n538774766\\r\\n7521020\\r\\n782227455\\r\\n932947153\\r\\n766620629\\r\\n621895347\\r\\n948462500\\r\\n49828435\\r\\n465611859\\r\\n508795684\\r\\n965408363\\r\\n876217222\\r\\n27461852\\r\\n849541586\\r\\n889517699\\r\\n887546242\\r\\n347913548\\r\\n274305965\\r\\n434804057\\r\\n916014055\\r\\n822187302\\r\\n339400794\\r\\n604867800\\r\\n368133826\\r\\n799958426\\r...', '738045334\\r\\n159282105\\r\\n578763229\\r\\n578763229\\r\\n477846315\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n159282105\\r\\n738045334\\r\\n159282105\\r\\n159282105\\r\\n738045334\\r\\n159282105\\r\\n738045334\\r\\n159282105\\r\\n578763229\\r\\n738045334\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n738045334\\r\\n578763229\\r\\n578763229\\r\\n578763229\\r\\n159282105\\r\\n578763229\\r\\n318564210\\r\\n578763229\\r\\n578763229\\r\\n159282105\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n159282105\\r\\n578763229\\r\\n159282105\\r\\n738045334\\r\\n578763229\\r\\n159282105\\r\\n159282105\\r\\n578763229\\r\\n738045334\\r\\n159282105\\r\\n738045334\\r\\n318564210\\r\\n73804...', '536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n536539890\\r\\n53653...', '544865927\\r\\n362689553\\r\\n554047941\\r\\n662901553\\r\\n528631083\\r\\n623245685\\r\\n408599623\\r\\n383515404\\r\\n454842332\\r\\n96411147\\r\\n49835799\\r\\n979215047\\r\\n123957189\\r\\n241194187\\r\\n232012173\\r\\n930510515\\r\\n682596137\\r\\n940690446\\r\\n985602599\\r\\n592905181\\r\\n837226469\\r\\n463026429\\r\\n366947921\\r\\n259890854\\r\\n259558215\\r\\n423037922\\r\\n336940056\\r\\n739152127\\r\\n906091574\\r\\n273663875\\r\\n103463977\\r\\n218239152\\r\\n323832313\\r\\n988397061\\r\\n861312771\\r\\n369742383\\r\\n261687399\\r\\n997579075\\r\\n494364850\\r\\n668490477\\r\\n306599552\\r\\n268740229\\r\\n776878100\\r\\n482521724\\r\\n140192033\\r\\n252172746\\r\\n5279658...', '156061854\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n52020618\\r\\n52020618\\r\\n104041236\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n156061854\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n208082472\\r\\n208082472\\r\\n104041236\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n156061854\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n52020618\\r\\n52020618\\r\\n156061854\\r\\n156061854\\r\\n104041236\\r\\n52020618\\r\\n52020618\\r\\n156061854\\r\\n104041236\\r\\n52020618\\r\\n104041236\\r\\n104041236\\r\\n104041236\\r\\n156061854\\r\\n52020618\\r...', '696015721\\r\\n931773777\\r\\n559486112\\r\\n847360916\\r\\n520999237\\r\\n330674091\\r\\n901387332\\r\\n817005789\\r\\n311776972\\r\\n19589756\\r\\n894472615\\r\\n644360731\\r\\n540588993\\r\\n761762342\\r\\n387103251\\r\\n712279217\\r\\n24626123\\r\\n870308250\\r\\n487286532\\r\\n403104550\\r\\n728773592\\r\\n564260282\\r\\n775161336\\r\\n604919022\\r\\n382066884\\r\\n133895986\\r\\n14584707\\r\\n323728056\\r\\n371794589\\r\\n189832070\\r\\n664212684\\r\\n375120849\\r\\n841631912\\r\\n277833388\\r\\n899970740\\r\\n674023221\\r\\n550168651\\r\\n205864687\\r\\n292155898\\r\\n484652909\\r\\n899246785\\r\\n641496229\\r\\n604195067\\r\\n520275282\\r\\n140579824\\r\\n200828320\\r\\n88943624...', '381761597\\r\\n749914123\\r\\n734966985\\r\\n451112838\\r\\n254375974\\r\\n408043495\\r\\n50147455\\r\\n317426730\\r\\n691474180\\r\\n297424671\\r\\n16576556\\r\\n950550287\\r\\n615062290\\r\\n508772409\\r\\n574097914\\r\\n755479957\\r\\n504073337\\r\\n232598914\\r\\n376960541\\r\\n704800943\\r\\n722703963\\r\\n943084953\\r\\n852281936\\r\\n604167024\\r\\n430991955\\r\\n691776511\\r\\n979477939\\r\\n916779041\\r\\n928976757\\r\\n9004809\\r\\n66623088\\r\\n160364271\\r\\n569831785\\r\\n753768578\\r\\n10158931\\r\\n829943628\\r\\n860984852\\r\\n599688760\\r\\n746963293\\r\\n90503616\\r\\n665117495\\r\\n843614199\\r\\n773004798\\r\\n52464119\\r\\n40225734\\r\\n193061049\\r\\n476979003\\r\\n451...']}, {'input': '2000 300\\r\\n1 1 1 0 0 1 1 0 0 1 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 1 1 0 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 0 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0...', 'output': ['520991218\\r\\n260495609\\r\\n781486827\\r\\n281527765\\r\\n460706912\\r\\n260495609\\r\\n43738083\\r\\n819065206\\r\\n639886059\\r\\n260495609\\r\\n639886059\\r\\n520991218\\r\\n520991218\\r\\n639886059\\r\\n819065206\\r\\n520991218\\r\\n639886059\\r\\n819065206\\r\\n639886059\\r\\n43738083\\r\\n781486827\\r\\n260495609\\r\\n520991218\\r\\n781486827\\r\\n819065206\\r\\n639886059\\r\\n281527765\\r\\n819065206\\r\\n460706912\\r\\n260495609\\r\\n639886059\\r\\n260495609\\r\\n304233692\\r\\n781486827\\r\\n260495609\\r\\n260495609\\r\\n43738083\\r\\n260495609\\r\\n639886059\\r\\n260495609\\r\\n819065206\\r\\n520991218\\r\\n520991218\\r\\n639886059\\r\\n639886059\\r\\n460706912\\r\\n26049560...']}, {'input': '2000 300\\r\\n1 1 1 0 0 0 1 0 1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1...', 'output': ['967309723\\r\\n488979754\\r\\n894231131\\r\\n227079250\\r\\n800673042\\r\\n803173636\\r\\n302660701\\r\\n49359452\\r\\n361182334\\r\\n613837368\\r\\n903714465\\r\\n783149148\\r\\n772569418\\r\\n153771444\\r\\n347053203\\r\\n383800081\\r\\n305903959\\r\\n591371347\\r\\n504143617\\r\\n554819601\\r\\n711091639\\r\\n993123371\\r\\n662636534\\r\\n799549517\\r\\n755795853\\r\\n257472564\\r\\n749178682\\r\\n44165553\\r\\n754769201\\r\\n677121173\\r\\n77251408\\r\\n825363165\\r\\n94378162\\r\\n905743915\\r\\n555723948\\r\\n401067893\\r\\n365827394\\r\\n778249947\\r\\n641361749\\r\\n657808321\\r\\n76885722\\r\\n205390090\\r\\n357248290\\r\\n762413024\\r\\n471855369\\r\\n953559875\\r\\n452364595\\r...']}, {'input': '2000 300\\r\\n1 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 0 1 0 0 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 0 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 0 1 1 0 1...', 'output': ['353668818\\r\\n180952778\\r\\n350267066\\r\\n85276305\\r\\n498935339\\r\\n570367769\\r\\n947922902\\r\\n520199571\\r\\n977020824\\r\\n311854081\\r\\n369942273\\r\\n709342799\\r\\n241020253\\r\\n306637091\\r\\n574362410\\r\\n924893301\\r\\n259050261\\r\\n881412462\\r\\n505397126\\r\\n426307000\\r\\n368001455\\r\\n187561592\\r\\n507502858\\r\\n422600821\\r\\n840032307\\r\\n570586935\\r\\n847077944\\r\\n633577890\\r\\n21924242\\r\\n429617104\\r\\n40169532\\r\\n200231692\\r\\n301247265\\r\\n526536756\\r\\n236599712\\r\\n449404280\\r\\n482154139\\r\\n74891321\\r\\n744845075\\r\\n202529472\\r\\n497487224\\r\\n750227627\\r\\n791509388\\r\\n365064757\\r\\n435991351\\r\\n911452637\\r\\n230155510...']}, {'input': '200000 3000\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n830309264\\r\\n83030...', '746090912\\r\\n987874942\\r\\n493937471\\r\\n493937471\\r\\n241784030\\r\\n493937471\\r\\n746090912\\r\\n241784030\\r\\n746090912\\r\\n987874942\\r\\n493937471\\r\\n241784030\\r\\n493937471\\r\\n493937471\\r\\n987874942\\r\\n493937471\\r\\n987874942\\r\\n746090912\\r\\n746090912\\r\\n493937471\\r\\n746090912\\r\\n493937471\\r\\n493937471\\r\\n483568060\\r\\n493937471\\r\\n746090912\\r\\n746090912\\r\\n241784030\\r\\n746090912\\r\\n746090912\\r\\n987874942\\r\\n493937471\\r\\n746090912\\r\\n493937471\\r\\n746090912\\r\\n746090912\\r\\n746090912\\r\\n493937471\\r\\n746090912\\r\\n746090912\\r\\n746090912\\r\\n241784030\\r\\n493937471\\r\\n746090912\\r\\n241784030\\r\\n493937471\\r\\n49393...', '249477932\\r\\n163324885\\r\\n619370540\\r\\n591761649\\r\\n381202278\\r\\n400495236\\r\\n181619933\\r\\n483987183\\r\\n768059384\\r\\n853879792\\r\\n648642618\\r\\n525566838\\r\\n955999425\\r\\n754753895\\r\\n409143808\\r\\n470016419\\r\\n322658124\\r\\n100123809\\r\\n150684670\\r\\n101454359\\r\\n634006577\\r\\n229187060\\r\\n466357410\\r\\n35592186\\r\\n769389935\\r\\n547853534\\r\\n85820409\\r\\n289061762\\r\\n201245531\\r\\n244821008\\r\\n910095485\\r\\n40581744\\r\\n910760760\\r\\n733797749\\r\\n450390828\\r\\n440079067\\r\\n811634863\\r\\n573799237\\r\\n619703176\\r\\n460037301\\r\\n90144696\\r\\n512261348\\r\\n656958547\\r\\n636002401\\r\\n271099351\\r\\n573799237\\r\\n748766427...', '337242164\\r\\n175981139\\r\\n705993748\\r\\n951319188\\r\\n208728534\\r\\n926966446\\r\\n894219051\\r\\n142402527\\r\\n394342301\\r\\n747271382\\r\\n832167014\\r\\n925728471\\r\\n915824671\\r\\n371227534\\r\\n265828671\\r\\n404110515\\r\\n737503168\\r\\n526705442\\r\\n275596885\\r\\n225789012\\r\\n140757794\\r\\n548311062\\r\\n834642964\\r\\n960680644\\r\\n982693022\\r\\n298440480\\r\\n97139796\\r\\n357880981\\r\\n649164783\\r\\n74025029\\r\\n270644985\\r\\n37970467\\r\\n945129313\\r\\n422137796\\r\\n739979118\\r\\n389390401\\r\\n815106536\\r\\n311922619\\r\\n858860120\\r\\n411267193\\r\\n976503147\\r\\n835880939\\r\\n13346553\\r\\n661137775\\r\\n978979097\\r\\n527943417\\r\\n707231723...', '895547075\\r\\n50488475\\r\\n972784199\\r\\n737802803\\r\\n134349212\\r\\n579628449\\r\\n120501272\\r\\n588315405\\r\\n599840552\\r\\n714837825\\r\\n262849659\\r\\n448375127\\r\\n596572279\\r\\n172710075\\r\\n108458976\\r\\n317466571\\r\\n845058600\\r\\n348860806\\r\\n506174996\\r\\n501269960\\r\\n76979425\\r\\n561049607\\r\\n754144168\\r\\n500496863\\r\\n56852638\\r\\n736253107\\r\\n323142953\\r\\n631062404\\r\\n987492303\\r\\n864152840\\r\\n155163780\\r\\n16686131\\r\\n341291713\\r\\n213479047\\r\\n623578627\\r\\n815212310\\r\\n74571316\\r\\n580316230\\r\\n11782846\\r\\n9977202\\r\\n56164857\\r\\n453363728\\r\\n283577160\\r\\n112674480\\r\\n770828548\\r\\n441236116\\r\\n475210843\\r\\n997...', '743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n743696736\\r\\n74369...', '743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n743692044\\r\\n74369...', '34499784\\r\\n374247743\\r\\n362747815\\r\\n297560637\\r\\n574121750\\r\\n869682055\\r\\n449997441\\r\\n458622387\\r\\n930182193\\r\\n940681955\\r\\n376622642\\r\\n28249737\\r\\n622933686\\r\\n969931858\\r\\n400622664\\r\\n671871138\\r\\n811807848\\r\\n331623096\\r\\n223311188\\r\\n305748258\\r\\n203623639\\r\\n439935004\\r\\n185436339\\r\\n481622243\\r\\n517559518\\r\\n585621678\\r\\n66124586\\r\\n679996001\\r\\n894244918\\r\\n45999712\\r\\n243436062\\r\\n887057463\\r\\n525184298\\r\\n990056732\\r\\n154311620\\r\\n198873841\\r\\n227623661\\r\\n430809975\\r\\n12937419\\r\\n194561368\\r\\n140374035\\r\\n610059025\\r\\n715495951\\r\\n677058261\\r\\n731308352\\r\\n710120554\\r\\n143749100\\r...', '743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n743697003\\r\\n74369...', '563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n563659040\\r\\n56365...', '948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n948860384\\r\\n94886...', '616415891\\r\\n743692045\\r\\n743692045\\r\\n616415891\\r\\n489139737\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n870968199\\r\\n616415891\\r\\n743692045\\r\\n616415891\\r\\n743692045\\r\\n743692045\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n489139737\\r\\n870968199\\r\\n870968199\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n616415891\\r\\n743692045\\r\\n743692045\\r\\n743692045\\r\\n361863583\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n743692045\\r\\n743692045\\r\\n870968199\\r\\n870968199\\r\\n616415891\\r\\n870968199\\r\\n743692045\\r\\n743692045\\r\\n107311275\\r\\n743692045\\r\\n870968199\\r\\n870968199\\r\\n87096...']}, {'input': '200000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['534464893\\r\\n70685433\\r\\n141370866\\r\\n605150326\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n605150326\\r\\n605150326\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n141370866\\r\\n70685433\\r\\n534464893\\r\\n141370866\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n534464893\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n70685433\\r\\n534464893\\r\\n70685433\\r\\n70685433\\r\\n605150326\\r\\n70685433\\r\\n70685433\\r\\n70685433\\r\\n...', '434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n434349889\\r\\n43434...', '479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n479343004\\r\\n47934...', '983882738\\r\\n723119688\\r\\n459823065\\r\\n556901314\\r\\n70724963\\r\\n266615302\\r\\n669551615\\r\\n128160584\\r\\n374823721\\r\\n636048406\\r\\n410086236\\r\\n880577836\\r\\n119251355\\r\\n80183061\\r\\n594759171\\r\\n13376576\\r\\n422252375\\r\\n548479185\\r\\n235532967\\r\\n555429175\\r\\n697576973\\r\\n194705367\\r\\n244991065\\r\\n696417466\\r\\n575930209\\r\\n911572937\\r\\n690252582\\r\\n173917166\\r\\n286156762\\r\\n203240195\\r\\n371392343\\r\\n232850391\\r\\n10955702\\r\\n65159878\\r\\n81942367\\r\\n928468125\\r\\n286592932\\r\\n499727395\\r\\n803102816\\r\\n81855133\\r\\n235158566\\r\\n824901521\\r\\n295851097\\r\\n716980269\\r\\n913157775\\r\\n996485047\\r\\n807919099\\r\\n4...', '535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n535630737\\r\\n53563...', '483259721\\r\\n483259721\\r\\n451534810\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n709027126\\r\\n483259721\\r\\n966519442\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n740752037\\r\\n225767405\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n451534810\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n966519442\\r\\n225767405\\r\\n740752037\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n740752037\\r\\n740752037\\r\\n483259721\\r\\n740752037\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n483259721\\r\\n225767405\\r\\n740752037\\r\\n483259721\\r\\n225767405\\r\\n740752037\\r\\n74075...', '365182673\\r\\n453133330\\r\\n646237559\\r\\n383557795\\r\\n419033749\\r\\n340436101\\r\\n116418016\\r\\n678527788\\r\\n945667567\\r\\n79030627\\r\\n870994872\\r\\n815130278\\r\\n370916978\\r\\n677151415\\r\\n467150520\\r\\n882361399\\r\\n890542201\\r\\n249936864\\r\\n39196741\\r\\n947579002\\r\\n636680384\\r\\n295607138\\r\\n675342063\\r\\n808325849\\r\\n29104504\\r\\n25918779\\r\\n103037971\\r\\n291784268\\r\\n445589673\\r\\n215200138\\r\\n658241231\\r\\n704446567\\r\\n478414964\\r\\n374535682\\r\\n193639291\\r\\n871632017\\r\\n186732779\\r\\n291784268\\r\\n138616008\\r\\n491795009\\r\\n475331322\\r\\n689894315\\r\\n243667497\\r\\n853256895\\r\\n714003742\\r\\n774124185\\r\\n363271238...', '985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n985422205\\r\\n98542...', '155925765\\r\\n487818429\\r\\n547205425\\r\\n780737503\\r\\n891037610\\r\\n578930143\\r\\n825301017\\r\\n138861660\\r\\n552655747\\r\\n896394864\\r\\n881431780\\r\\n167493014\\r\\n480546290\\r\\n147428613\\r\\n697960072\\r\\n762448385\\r\\n870903408\\r\\n251332589\\r\\n614973238\\r\\n898519152\\r\\n581333635\\r\\n223833180\\r\\n271513325\\r\\n829479792\\r\\n130457576\\r\\n488950374\\r\\n631091534\\r\\n259853008\\r\\n403102846\\r\\n643511524\\r\\n491144463\\r\\n683066789\\r\\n279987210\\r\\n916459265\\r\\n497517327\\r\\n461078693\\r\\n513286618\\r\\n11055375\\r\\n943036132\\r\\n453946156\\r\\n770116063\\r\\n285321197\\r\\n954649915\\r\\n686299755\\r\\n305432132\\r\\n314991428\\r\\n917591...', '979248391\\r\\n467909552\\r\\n175190733\\r\\n498757573\\r\\n436634896\\r\\n282945489\\r\\n831422982\\r\\n525572199\\r\\n608769567\\r\\n291190788\\r\\n623553625\\r\\n907228321\\r\\n19120025\\r\\n908756352\\r\\n635157558\\r\\n367120190\\r\\n895500325\\r\\n121864053\\r\\n271093430\\r\\n805461626\\r\\n799170993\\r\\n621048261\\r\\n209948086\\r\\n214834751\\r\\n291190788\\r\\n88084033\\r\\n941559039\\r\\n256433435\\r\\n462472189\\r\\n261870798\\r\\n718354926\\r\\n62673375\\r\\n599120300\\r\\n207566785\\r\\n71042737\\r\\n669914911\\r\\n844128311\\r\\n594233635\\r\\n758976277\\r\\n186492094\\r\\n238841441\\r\\n949377703\\r\\n280013490\\r\\n621474896\\r\\n309333480\\r\\n356245464\\r\\n817740320...']}, {'input': '200000 3000\\r\\n0 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0 0 1 1 1 1 0 0 1 0 0 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 0 0 1 1 1 0 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 1 1 1 1 0 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 ...', 'output': ['684128648\\r\\n534537704\\r\\n70831055\\r\\n605368759\\r\\n605368759\\r\\n534537704\\r\\n55897238\\r\\n70831055\\r\\n534537704\\r\\n534537704\\r\\n605368759\\r\\n684128648\\r\\n55897238\\r\\n740025886\\r\\n534537704\\r\\n70831055\\r\\n70831055\\r\\n684128648\\r\\n70831055\\r\\n684128648\\r\\n425910181\\r\\n70831055\\r\\n605368759\\r\\n534537704\\r\\n534537704\\r\\n605368759\\r\\n684128648\\r\\n70831055\\r\\n684128648\\r\\n605368759\\r\\n70831055\\r\\n370012943\\r\\n370012943\\r\\n370012943\\r\\n605368759\\r\\n70831055\\r\\n534537704\\r\\n70831055\\r\\n370012943\\r\\n141662110\\r\\n534537704\\r\\n370012943\\r\\n370012943\\r\\n70831055\\r\\n684128648\\r\\n370012943\\r\\n684128648\\r\\n5345377...']}, {'input': '200000 3000\\r\\n1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 1 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0 1 1 0 0 0 1 1 1 1 0 1 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ...', 'output': ['331265679\\r\\n248932636\\r\\n609274319\\r\\n474255977\\r\\n102055814\\r\\n485644908\\r\\n626044190\\r\\n431097835\\r\\n319780031\\r\\n47044666\\r\\n687413158\\r\\n404806427\\r\\n125126455\\r\\n282606731\\r\\n307585492\\r\\n584577913\\r\\n604465119\\r\\n366599088\\r\\n490459582\\r\\n11853006\\r\\n753101524\\r\\n749114305\\r\\n816668970\\r\\n25465595\\r\\n942396724\\r\\n387086401\\r\\n558715961\\r\\n470999022\\r\\n908318742\\r\\n535377307\\r\\n712631115\\r\\n501708418\\r\\n465458062\\r\\n906281962\\r\\n309027298\\r\\n466289495\\r\\n88346508\\r\\n21689911\\r\\n46580591\\r\\n650678352\\r\\n435081076\\r\\n202663995\\r\\n554027989\\r\\n280201535\\r\\n865380747\\r\\n516485969\\r\\n226759102\\r\\n...']}, {'input': '200000 3000\\r\\n0 0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 1 0 1 ...', 'output': ['702758762\\r\\n222668721\\r\\n663197048\\r\\n675792950\\r\\n759259581\\r\\n332486741\\r\\n171127920\\r\\n414458191\\r\\n349087590\\r\\n847918503\\r\\n522872021\\r\\n540727038\\r\\n813504457\\r\\n278812310\\r\\n949679696\\r\\n784095578\\r\\n918470307\\r\\n482110597\\r\\n535952792\\r\\n109088580\\r\\n967478176\\r\\n268019403\\r\\n523209396\\r\\n80286422\\r\\n566422901\\r\\n182974112\\r\\n166764579\\r\\n716767192\\r\\n203579125\\r\\n975507557\\r\\n770975186\\r\\n884777286\\r\\n433828625\\r\\n891459014\\r\\n519109900\\r\\n907459392\\r\\n591988953\\r\\n479131884\\r\\n989822907\\r\\n846824242\\r\\n304414023\\r\\n13755521\\r\\n6710438\\r\\n355497544\\r\\n718926904\\r\\n912736930\\r\\n173287893...']}, {'input': '10 3000\\r\\n1 1 1 1 1 0 0 0 1 1\\r\\n6 22 5 2 4 15 4 7 31 4\\r\\n', 'output': ['561258918\\r\\n61460660\\r\\n467715765\\r\\n187086306\\r\\n374172612\\r\\n538110090\\r\\n143496024\\r\\n251118042\\r\\n903349037\\r\\n374172612']}, {'input': '100 3000\\r\\n0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\\r\\n10 8 1 9 7 5 12 9 15 7 16 5 17 5 17 21 11 3 4 4 30 17 3 84 12 30 2 8 2 2 22 24 15 11 15 13 7 17 1 12 8 4 3 6 5 15 1 3 4 2 27 3 11 11 3 3 3 5 14 2 5 13 6 2 6 5 6 19 3 16 4 12 11 2 2 3 25 14 6 11 22 4 10 32 9 19 14 2 2 3 4 3 2 5 18 14 2 7 3 8\\r\\n', 'output': ['23677346\\r\\n418239618\\r\\n800963217\\r\\n220958482\\r\\n615520754\\r\\n11838673\\r\\n627359427\\r\\n220958482\\r\\n35516019\\r\\n615520754\\r\\n836479236\\r\\n11838673\\r\\n639198100\\r\\n11838673\\r\\n639198100\\r\\n848317909\\r\\n824640563\\r\\n406400945\\r\\n209119809\\r\\n209119809\\r\\n71032038\\r\\n639198100\\r\\n406400945\\r\\n398538577\\r\\n627359427\\r\\n71032038\\r\\n603682081\\r\\n418239618\\r\\n19778681\\r\\n603682081\\r\\n651036773\\r\\n256474501\\r\\n35516019\\r\\n824640563\\r\\n35516019\\r\\n430078291\\r\\n615520754\\r\\n639198100\\r\\n800963217\\r\\n627359427\\r\\n418239618\\r\\n209119809\\r\\n406400945\\r\\n812801890\\r\\n11838673\\r\\n35516019\\r\\n800963217\\r\\n406400...']}, {'input': '1000 3000\\r\\n0 0 1 0 1 0 0 1 1 1 1 0 1 0 0 1 1 0 0 0 0 0 0 1 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 ...', 'output': ['984664827\\r\\n971085301\\r\\n837724678\\r\\n984664827\\r\\n225735001\\r\\n971085301\\r\\n984664827\\r\\n611989677\\r\\n65215326\\r\\n611989677\\r\\n837724678\\r\\n984664827\\r\\n225735001\\r\\n984664827\\r\\n971085301\\r\\n225735001\\r\\n225735001\\r\\n984664827\\r\\n971085301\\r\\n957505775\\r\\n971085301\\r\\n984664827\\r\\n943926249\\r\\n225735001\\r\\n971085301\\r\\n611989677\\r\\n837724678\\r\\n971085301\\r\\n225735001\\r\\n971085301\\r\\n225735001\\r\\n971085301\\r\\n984664827\\r\\n971085301\\r\\n943926249\\r\\n943926249\\r\\n611989677\\r\\n971085301\\r\\n984664827\\r\\n957505775\\r\\n971085301\\r\\n225735001\\r\\n971085301\\r\\n971085301\\r\\n225735001\\r\\n837724678\\r\\n611989...']}, {'input': '1000 3000\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['499122179\\r\\n5\\r\\n499122179\\r\\n5\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122184\\r\\n499122179\\r\\n5\\r\\n5\\r\\n5\\r\\n499122184\\r\\n10\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122184\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n5\\r\\n499122184\\r\\n5\\r\\n499122184\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122179\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122184\\r\\n5\\r\\n499122179\\r\\n5\\r\\n499122179\\r\\n499122184\\r\\n499122184\\r\\n5...']}, {'input': '199990 3000\\r\\n1 0 0 1 0 1 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 0 1 1 0 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 ...', 'output': ['646452156\\r\\n960868656\\r\\n118518242\\r\\n184272685\\r\\n747024268\\r\\n964037469\\r\\n951101180\\r\\n377347150\\r\\n254993892\\r\\n11139421\\r\\n70322210\\r\\n525571057\\r\\n926475930\\r\\n63428346\\r\\n756018063\\r\\n626131891\\r\\n466781454\\r\\n656042659\\r\\n69698706\\r\\n359694160\\r\\n226813875\\r\\n191435355\\r\\n897230167\\r\\n851910875\\r\\n872964055\\r\\n741910138\\r\\n963242791\\r\\n859073545\\r\\n501205753\\r\\n252469038\\r\\n77916365\\r\\n622358084\\r\\n867246600\\r\\n381481659\\r\\n57646031\\r\\n326439010\\r\\n37314488\\r\\n267966014\\r\\n386173645\\r\\n224253188\\r\\n693822089\\r\\n652063749\\r\\n209704954\\r\\n936775840\\r\\n675102836\\r\\n581756207\\r\\n18809453\\r\\n84...']}, {'input': '199991 3000\\r\\n1 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 1 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1 0 0 1 0 0 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 ...', 'output': ['576788803\\r\\n851579816\\r\\n464431389\\r\\n925910539\\r\\n240339104\\r\\n317886519\\r\\n67707478\\r\\n262772669\\r\\n221595177\\r\\n612937974\\r\\n736137684\\r\\n268724388\\r\\n68361383\\r\\n847191682\\r\\n557301933\\r\\n913346054\\r\\n648280739\\r\\n171995554\\r\\n235269506\\r\\n530242292\\r\\n148650394\\r\\n908499525\\r\\n304200830\\r\\n721371958\\r\\n474031015\\r\\n817280262\\r\\n825707282\\r\\n465373250\\r\\n245622892\\r\\n341231679\\r\\n845696111\\r\\n853007293\\r\\n68361383\\r\\n915771149\\r\\n987480726\\r\\n726171771\\r\\n707992711\\r\\n478931968\\r\\n847890178\\r\\n687514833\\r\\n732279394\\r\\n927044872\\r\\n856499296\\r\\n862463110\\r\\n77307104\\r\\n484794642\\r\\n615409785...']}, {'input': '199992 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 ...', 'output': ['944579271\\r\\n815447430\\r\\n121435610\\r\\n89385736\\r\\n85360285\\r\\n56962924\\r\\n289585947\\r\\n344015172\\r\\n223771444\\r\\n652123221\\r\\n591303048\\r\\n4248454\\r\\n306743823\\r\\n968709911\\r\\n670850059\\r\\n672191876\\r\\n417953645\\r\\n24521845\\r\\n946915719\\r\\n777789018\\r\\n60838440\\r\\n839186865\\r\\n79733480\\r\\n134590444\\r\\n755625163\\r\\n504520550\\r\\n752912502\\r\\n172585260\\r\\n452314215\\r\\n812559060\\r\\n865646468\\r\\n584772439\\r\\n717751255\\r\\n344015172\\r\\n217454686\\r\\n551825\\r\\n985330789\\r\\n733776192\\r\\n951920831\\r\\n371680341\\r\\n447096882\\r\\n332238689\\r\\n688429333\\r\\n390729899\\r\\n623930596\\r\\n453096625\\r\\n858100172\\r\\n14638...']}, {'input': '199993 3000\\r\\n1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...', 'output': ['189220773\\r\\n219328456\\r\\n767760662\\r\\n806220888\\r\\n797979411\\r\\n545740580\\r\\n219383989\\r\\n75297991\\r\\n40929720\\r\\n935115229\\r\\n532004785\\r\\n529257626\\r\\n49282263\\r\\n789793467\\r\\n545740580\\r\\n962586819\\r\\n485358615\\r\\n471678353\\r\\n907699172\\r\\n803473729\\r\\n408604762\\r\\n963918788\\r\\n35602001\\r\\n847372740\\r\\n611561330\\r\\n216636830\\r\\n729467035\\r\\n298885001\\r\\n73784562\\r\\n95928433\\r\\n405857603\\r\\n312620796\\r\\n126147182\\r\\n518268990\\r\\n353717115\\r\\n501841569\\r\\n512830205\\r\\n685568024\\r\\n252294364\\r\\n962586819\\r\\n477172671\\r\\n252637898\\r\\n246744513\\r\\n434391811\\r\\n52084955\\r\\n807039242\\r\\n414043547\\r\\n2...']}, {'input': '199994 3000\\r\\n0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 0 0 1 0 0 0 1 1 1 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 1 ...', 'output': ['336654971\\r\\n732535\\r\\n815250185\\r\\n326444659\\r\\n729180253\\r\\n129624924\\r\\n358796707\\r\\n444866639\\r\\n754810869\\r\\n843551608\\r\\n256744726\\r\\n70820418\\r\\n164515107\\r\\n207034102\\r\\n575220043\\r\\n87535002\\r\\n682699176\\r\\n43984065\\r\\n797070531\\r\\n806189316\\r\\n815982720\\r\\n704840912\\r\\n900587582\\r\\n585042405\\r\\n921264248\\r\\n459213067\\r\\n352526818\\r\\n883140463\\r\\n815669240\\r\\n511377385\\r\\n785483692\\r\\n225259507\\r\\n505565288\\r\\n832271475\\r\\n46481077\\r\\n860266192\\r\\n560703064\\r\\n99613410\\r\\n150730663\\r\\n410704936\\r\\n704840912\\r\\n915837096\\r\\n953960881\\r\\n968477860\\r\\n589004487\\r\\n187389378\\r\\n517884662\\r\\n93...']}, {'input': '199995 3000\\r\\n0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 ...', 'output': ['662762303\\r\\n929872487\\r\\n874878479\\r\\n456275271\\r\\n715183658\\r\\n400437516\\r\\n521458497\\r\\n76578537\\r\\n927594887\\r\\n897280874\\r\\n185062970\\r\\n530346011\\r\\n941267798\\r\\n71793140\\r\\n377419134\\r\\n675559304\\r\\n591654880\\r\\n719511098\\r\\n599406031\\r\\n622421976\\r\\n250476393\\r\\n605557988\\r\\n772627865\\r\\n133099572\\r\\n594620634\\r\\n848508553\\r\\n404542070\\r\\n193952921\\r\\n255031593\\r\\n40568087\\r\\n771704693\\r\\n756662785\\r\\n869935052\\r\\n847369753\\r\\n36238210\\r\\n358730629\\r\\n164552385\\r\\n938076721\\r\\n767600139\\r\\n458579571\\r\\n693757159\\r\\n843723156\\r\\n975014694\\r\\n858992824\\r\\n955398666\\r\\n756432588\\r\\n585958443...']}, {'input': '199996 3000\\r\\n0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 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 1 1 0 ...', 'output': ['670876956\\r\\n282683795\\r\\n377011834\\r\\n803395587\\r\\n676385588\\r\\n935914218\\r\\n718622147\\r\\n536417373\\r\\n403228588\\r\\n282205508\\r\\n715874782\\r\\n593703261\\r\\n180906172\\r\\n125082949\\r\\n159213672\\r\\n79114647\\r\\n828013417\\r\\n919922217\\r\\n269261194\\r\\n677998414\\r\\n539957249\\r\\n116020539\\r\\n719578721\\r\\n947915860\\r\\n933837007\\r\\n911830283\\r\\n475864127\\r\\n320232037\\r\\n207122926\\r\\n915004383\\r\\n801796663\\r\\n301300804\\r\\n489000308\\r\\n929955103\\r\\n208735752\\r\\n169096397\\r\\n431236133\\r\\n485282467\\r\\n675865595\\r\\n711172563\\r\\n31711484\\r\\n780760415\\r\\n330893371\\r\\n339149368\\r\\n107928605\\r\\n630648538\\r\\n1150500...']}, {'input': '199997 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...', 'output': ['509540793\\r\\n120976575\\r\\n549866318\\r\\n103886913\\r\\n46471726\\r\\n486304930\\r\\n356783524\\r\\n889560180\\r\\n199228995\\r\\n889560180\\r\\n825998792\\r\\n728258080\\r\\n40325525\\r\\n723460820\\r\\n584045642\\r\\n849234655\\r\\n398457990\\r\\n44073096\\r\\n355733835\\r\\n753892573\\r\\n259042812\\r\\n526630455\\r\\n218717287\\r\\n69707589\\r\\n445979405\\r\\n843088454\\r\\n549866318\\r\\n900503641\\r\\n915194673\\r\\n110033114\\r\\n233408319\\r\\n632915998\\r\\n443580775\\r\\n883413979\\r\\n356783524\\r\\n63561388\\r\\n314059369\\r\\n628118738\\r\\n543720117\\r\\n420344912\\r\\n705022217\\r\\n89195881\\r\\n535175286\\r\\n987300892\\r\\n72106219\\r\\n543720117\\r\\n785673267\\r\\n2...', '791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n791536630\\r\\n79153...']}, {'input': '199998 3000\\r\\n1 0 1 1 1 0 1 0 1 1 1 1 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 1 1 1 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 0 0 0 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 0 1 1 0 1 1 1 1 0 0 0 1 0 1 1 1 0 0 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 1 1 1 0 0 1 1 0 0 ...', 'output': ['728321596\\r\\n638956912\\r\\n987568459\\r\\n799092377\\r\\n597086927\\r\\n782772546\\r\\n770287170\\r\\n255784080\\r\\n699516389\\r\\n256762390\\r\\n656812813\\r\\n513524780\\r\\n416026596\\r\\n285567597\\r\\n279669471\\r\\n136357125\\r\\n790734343\\r\\n479381626\\r\\n898668365\\r\\n822581531\\r\\n870855601\\r\\n827897584\\r\\n408064799\\r\\n759611276\\r\\n235779603\\r\\n990282556\\r\\n571135194\\r\\n279669471\\r\\n311516659\\r\\n287631268\\r\\n607109724\\r\\n822559637\\r\\n639460200\\r\\n369129744\\r\\n111968446\\r\\n157186402\\r\\n495141278\\r\\n652212868\\r\\n143815634\\r\\n367752526\\r\\n165008822\\r\\n592117981\\r\\n400788425\\r\\n793754430\\r\\n966900453\\r\\n2484473\\r\\n9089752...', '964927693\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n278374139\\r\\n278374139\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n964927693\\r\\n278374139\\r\\n964927693\\r\\n96492...']}, {'input': '199999 3000\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 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 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 1 1 1 0 1 1 ...', 'output': ['659992102\\r\\n43534688\\r\\n613251861\\r\\n688791385\\r\\n969096633\\r\\n244584877\\r\\n407865304\\r\\n186960964\\r\\n243317864\\r\\n549539932\\r\\n991833247\\r\\n262687380\\r\\n543128826\\r\\n494636937\\r\\n223625258\\r\\n610530943\\r\\n823731817\\r\\n148706567\\r\\n321255216\\r\\n793342431\\r\\n574351284\\r\\n666241663\\r\\n731705240\\r\\n759075965\\r\\n574351284\\r\\n267483036\\r\\n533214424\\r\\n650213898\\r\\n38254397\\r\\n748651581\\r\\n341432457\\r\\n458755021\\r\\n851102542\\r\\n458618823\\r\\n777016923\\r\\n879306339\\r\\n831596828\\r\\n223948348\\r\\n334458632\\r\\n214654779\\r\\n250672893\\r\\n599162636\\r\\n601914362\\r\\n888897651\\r\\n620419998\\r\\n546470577\\r\\n2155987...', '959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n550771238\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n550771238\\r\\n959626450\\r\\n959626450\\r\\n959626450\\r\\n95962...']}, {'input': '200000 3000\\r\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 ...', 'output': ['893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n917300718\\r\\n917300718\\r\\n917300718\\r\\n893407370\\r\\n893407370\\r\\n893407370\\r\\n89340...', '777798569\\r\\n231173131\\r\\n230887037\\r\\n573284389\\r\\n184819702\\r\\n389069614\\r\\n336642733\\r\\n374568480\\r\\n855432105\\r\\n25206655\\r\\n4356888\\r\\n605147597\\r\\n575616793\\r\\n296362756\\r\\n407873071\\r\\n112177054\\r\\n213967495\\r\\n814007752\\r\\n159623960\\r\\n280717246\\r\\n614422648\\r\\n758973286\\r\\n52239134\\r\\n765343745\\r\\n464084652\\r\\n192059356\\r\\n447272940\\r\\n617899428\\r\\n590679202\\r\\n570104616\\r\\n874554395\\r\\n774321789\\r\\n991301706\\r\\n991873894\\r\\n397156637\\r\\n113523353\\r\\n617052059\\r\\n46639523\\r\\n446403745\\r\\n35361814\\r\\n921640272\\r\\n891146426\\r\\n273084002\\r\\n58808253\\r\\n533015325\\r\\n30707919\\r\\n154980978\\r\\n71...']}, {'input': '200000 3000\\r\\n1 0 0 0 0 1 0 0 0 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 0 0 1 0 ...', 'output': ['203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n712662175\\r\\n203557555\\r\\n712662175\\r\\n203557555\\r\\n203557555\\r\\n71266...']}, {'input': '200000 3000\\r\\n0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 ...', 'output': ['532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n532284272\\r\\n23179652\\r\\n532284272\\r\\n23179652\\r\\n23179652\\r\\n532284272\\r\\n532284272\\r\\n53...']}]","id":165} {"description":"Game \"Minesweeper 1D\" is played on a line of squares, the line's height is 1 square, the line's width is n squares. Some of the squares contain bombs. If a square doesn't contain a bomb, then it contains a number from 0 to 2 \u2014 the total number of bombs in adjacent squares.For example, the correct field to play looks like that: 001*2***101*. The cells that are marked with \"*\" contain bombs. Note that on the correct field the numbers represent the number of bombs in adjacent cells. For example, field 2* is not correct, because cell with value 2 must have two adjacent cells with bombs.Valera wants to make a correct field to play \"Minesweeper 1D\". He has already painted a squared field with width of n cells, put several bombs on the field and wrote numbers into some cells. Now he wonders how many ways to fill the remaining cells with bombs and numbers are there if we should get a correct field in the end.","input_specification":"The first line contains sequence of characters without spaces s1s2... sn (1\u2009\u2264\u2009n\u2009\u2264\u2009106), containing only characters \"*\", \"?\" and digits \"0\", \"1\" or \"2\". If character si equals \"*\", then the i-th cell of the field contains a bomb. If character si equals \"?\", then Valera hasn't yet decided what to put in the i-th cell. Character si, that is equal to a digit, represents the digit written in the i-th square.","output_specification":"Print a single integer \u2014 the number of ways Valera can fill the empty cells and get a correct field. As the answer can be rather large, print it modulo 1000000007 (109\u2009+\u20097).","notes":"NoteIn the first test sample you can get the following correct fields: 001**1, 001***, 001*2*, 001*10.","sample_inputs":["?01???","?","**12","1"],"sample_outputs":["4","2","0","0"],"src_uid":"c16c49baf7b2d179764871204475036e","lang_cluster":"Python","difficulty":1900,"human_solution":"from sys import stdin\ndef main():\n s = stdin.readline().strip()\n if s[0] == '2' or s[-1] == '2':\n print 0\n return\n # 0, *1, 1*, *2*, *\n if s[0] == '?':\n dp = [1, 0, 1, 0, 1]\n elif s[0] == '0':\n dp = [1, 0, 0, 0, 0]\n elif s[0] == '1':\n dp = [0, 0, 1, 0, 0]\n elif s[0] == '*':\n dp = [0, 0, 0, 0, 1]\n def add(x, y):\n z = x + y\n return z if z < 1000000007 else z - 1000000007\n for c in s[1:]:\n if c == '*':\n ndp = [0, 0, 0, 0, add(dp[2], add(dp[3], dp[4]))]\n elif c == '0':\n ndp = [add(dp[0], dp[1]), 0, 0, 0, 0]\n elif c == '1':\n ndp = [0, dp[4], add(dp[0], dp[1]), 0, 0]\n elif c == '2':\n ndp = [0, 0, 0, dp[4], 0]\n else: \n ndp = [add(dp[0], dp[1]), dp[4], add(dp[0], dp[1]), dp[4], add(dp[2], add(dp[3], dp[4]))]\n dp = ndp\n print add(dp[0], add(dp[1], dp[4]))\nmain()\n","testcases":"[{'input': '?01???\\r\\n', 'output': ['4\\r\\n']}, {'input': '?\\r\\n', 'output': ['2\\r\\n']}, {'input': '**12\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n', 'output': ['0\\r\\n']}, {'input': '?01*??****\\r\\n', 'output': ['4\\r\\n']}, {'input': '0\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n', 'output': ['0\\r\\n']}, {'input': '*\\r\\n', 'output': ['1\\r\\n']}, {'input': '0*\\r\\n', 'output': ['0\\r\\n']}, {'input': '0?\\r\\n', 'output': ['1\\r\\n']}, {'input': '01\\r\\n', 'output': ['0\\r\\n']}, {'input': '1*\\r\\n', 'output': ['1\\r\\n']}, {'input': '1?\\r\\n', 'output': ['1\\r\\n']}, {'input': '?1?\\r\\n', 'output': ['2\\r\\n']}, {'input': '12\\r\\n', 'output': ['0\\r\\n']}, {'input': '2*\\r\\n', 'output': ['0\\r\\n']}, {'input': '2?\\r\\n', 'output': ['0\\r\\n']}, {'input': '2??\\r\\n', 'output': ['0\\r\\n']}, {'input': '?2?\\r\\n', 'output': ['1\\r\\n']}, {'input': '?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\\r\\n', 'output': ['147483634\\r\\n']}, {'input': '00***???01\\r\\n', 'output': ['0\\r\\n']}, {'input': '21?20*0000?2?22??0001*?1??12?20020200?**0*12?*221*0*1200*?0*11?022*110*2*2022120*2*2100*0?0*02?012?1\\r\\n', 'output': ['0\\r\\n']}]","id":166} {"description":"Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so on (arbitrary number of changes could be made in each number). At some point it turned out that if we sum the resulting numbers, then the number of zeroes with which the sum will end would be maximum among the possible variants of digit permutations in those numbers.Given number n, can you find the two digit permutations that have this property?","input_specification":"The first line contains a positive integer n \u2014 the original number. The number of digits in this number does not exceed 105. The number is written without any leading zeroes.","output_specification":"Print two permutations of digits of number n, such that the sum of these numbers ends with the maximum number of zeroes. The permutations can have leading zeroes (if they are present, they all should be printed). The permutations do not have to be different. If there are several answers, print any of them.","notes":null,"sample_inputs":["198","500"],"sample_outputs":["981\n819","500\n500"],"src_uid":"34b67958a37865e1ca0529bbf528dd9a","lang_cluster":"Python","difficulty":1900,"human_solution":"num = [0] * 10\nline = list(raw_input())\nfor i in line:\n num[ord(i) - ord('0')] += 1\nans = 0\nretstr1 = retstr2 = ''.join(sorted(line))\nfor first_i in range(1, 10):\n first_j = (10 - first_i) % 10\n cntx = [0] * 10\n cnty = [0] * 10\n cntx[first_i] += 1\n cnty[first_j] += 1\n if cntx[first_i] > num[first_i] or cnty[first_j] > num[first_j]:\n continue\n tmpstr1 = chr(ord('0') + first_i)\n tmpstr2 = chr(ord('0') + first_j)\n tmp = 1\n for i in range(10):\n l = min(num[i] - cntx[i], num[9-i] - cnty[9-i])\n cntx[i] += l\n cnty[9-i] += l\n tmp += l\n tmpstr1 += chr(ord('0') + i) * l\n tmpstr2 += chr(ord('0') + 9 - i) * l\n l = min(num[0] - cntx[0], num[0] - cnty[0])\n cntx[0] += l\n cnty[0] += l\n tmp += l\n tmpstr1 = chr(ord('0')) * l + tmpstr1\n tmpstr2 = chr(ord('0')) * l + tmpstr2\n for i in range(10):\n tmpstr1 += chr(ord('0') + i) * (num[i] - cntx[i])\n tmpstr2 += chr(ord('0') + i) * (num[i] - cnty[i])\n if ans < tmp:\n ans = tmp\n retstr1 = tmpstr1\n retstr2 = tmpstr2\nprint retstr1[::-1]\nprint retstr2[::-1]","testcases":"[{'input': '198\\r\\n', 'output': ['981\\r\\n819']}, {'input': '500\\r\\n', 'output': ['500\\r\\n500']}, {'input': '1061\\r\\n', 'output': ['1160\\r\\n1160', '6110\\r\\n6110']}, {'input': '1099\\r\\n', 'output': ['9901\\r\\n1099']}, {'input': '4877\\r\\n', 'output': ['4778\\r\\n4778', '8774\\r\\n8774']}, {'input': '787027\\r\\n', 'output': ['877720\\r\\n777280']}, {'input': '7665711\\r\\n', 'output': ['7766115\\r\\n7766115']}, {'input': '670042\\r\\n', 'output': ['672400\\r\\n427600']}, {'input': '87417\\r\\n', 'output': ['77481\\r\\n77418', '87741\\r\\n87741', '14778\\r\\n14778']}, {'input': '27183007\\r\\n', 'output': ['78721300\\r\\n31278700']}, {'input': '2603340571199714716025114079373828413509944752618962350632892540710372640383149198328312562980217104434880337288055817064\\r\\n', 'output': ['9444433333332219999999998888888888888777777777776666666655555555544444444433333333222222222221111111111111000000000100000\\r\\n4444333333322110000000001111111111111222222222223333333344444444455555555566666666777777777778888888888888999999999900000', '4444333333322109999999999888888888888877777777777666666665555555554444444443333333322222222222111111111111100000000010000\\r\\n4444333333322110000000000111111111111122222222222333333334444444445555555556666666677777777777888888888888899999999990000']}, {'input': '8679647744\\r\\n', 'output': ['9877766444\\r\\n9877764446']}, {'input': '220737406285\\r\\n', 'output': ['877654322200\\r\\n222345677800']}, {'input': '993522733475817\\r\\n', 'output': ['997533877542213\\r\\n995333122457787']}, {'input': '5057017252180797906185\\r\\n', 'output': ['7765551998877221100500\\r\\n7765551001122778899500']}, {'input': '12414711447744142772\\r\\n', 'output': ['11111222444444477777\\r\\n11111222444444477777', '77444444411111777222\\r\\n77444444411111222777', '77777444444422211111\\r\\n77777444444422211111']}, {'input': '3037225037514100860827276704\\r\\n', 'output': ['7887777665544332222113000000\\r\\n3112222334455667777887000000']}, {'input': '346762409573609367635944363650432097309\\r\\n', 'output': ['774499999776666666555444333333322000003\\r\\n744300000223333333444555666666677999997']}, {'input': '21504009080570645002760268009722803470954749000131\\r\\n', 'output': ['69999888777776655554444332222211100004000000000000\\r\\n40000111222223344445555667777788899996000000000000']}, {'input': '3311314413231141411421432122343321141133112122342341334443214\\r\\n', 'output': ['4444444444444433333333333333332222222222211111111111111111111\\r\\n4444444444444433333333333333332222222222211111111111111111111', '1111111111111111111122222222222333333333333333344444444444444\\r\\n1111111111111111111122222222222333333333333333344444444444444']}, {'input': '9070901003919040000887091134838800004472724709967020097067025050205000220352709096100405900207957128\\r\\n', 'output': ['7999999999999888888777777777766655555544444433322222222221111110000000000003000000000000000000000000\\r\\n3000000000000111111222222222233344444455555566677777777778888889999999999997000000000000000000000000']}, {'input': '41818138314831348134448848318148131818813388313344833114141141184383813143343448843131343384181384844431384114113314313144848133488818418384818848341344811441811141313448341888341118488811314338434488\\r\\n', 'output': ['88888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111\\r\\n88888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111', '11111111111111111111111111111111111111111111111111111133333333333333333333333333333333333333333333344444444444444444444444444444444444444444444444444888888888888888888888888888888888888888888888888888\\r\\n11111111111111111111111111111111111111111111111111111...', '44444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111888888888888888888888888888888888888888888888888888111111111111111111111111111111111111111111111111111\\r\\n44444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111888888888888888888888888888888888888888888888888888']}, {'input': '73552900025351606679224588872327647961330089042655630665222580520508672870102563487600132539752481214659858863022476410484266570139810532470714984092503934751571221521306943121997450187110428026190962582430971693370613087381790614697689671767000004095232276975952292053272119035138483846537407714434012224979098527763281110363860729062927455745190194649\\r\\n', 'output': ['66655222222221111111199999999999999999999999999999999988888888888888888888888888877777777777777777777777777777777777776666666666666666666666666666666555555555555555555555555555555544444444444444444444444444444443333333333333333333333333333333222222222222222222222222222222222222211111111111111111111111111100000000000000000000000000000000050000000000000\\r\\n666552222222211111111000000000000000000000000000000000111111111111111111111111111222222222222222222222222222222222222233333333333333333333333333333334444444...']}, {'input': '3660060360865606405406648718470765048005409506710925001850101061700007022407913434780234609002664580600302035550131007145010003815754853838580300966004029000300434981894159106340481587649046330570701648116012056320463003313141680800500509429100191307403765300801130020535489060555504004005803272823494700970010952879008030098004480465890588039380501581078422931611654908930340540303783403661632050700948101050151020160623940430284004280902060684751066629489507855752580027410505650019760020009138500203642800308...', 'output': ['8999999999999999999999999999999999888888888888888888888888888888888888888888888888888777777777777777777777777777777777666666666666666666666666666666666666666666666666666665555555555555555555555555555555555555555555555555555555554444444444444444444444444444444444444444444444444444444443333333333333333333333333333333333333333333333333333322222222222222222222222222222222211111111111111111111111111111111111111111111111111100000000000000000000000000000000020000000000000000000000000000000000000000000000000000000...']}, {'input': '3988405032201869838583516133943649897563464963199720203573666195109254972807095125585153139107836315540802254503122202208671231062969287785325745149827780975637820846694844717512181082423246460831153198676512327424647704185170864814344819230405434252307112870463387306341417126663194715993207482864102823774828380347931676663905538788367741598351252166769604140992179418820043419699163449596439979329298654494702555801641339987965927031928141345579024032222443566448480995335779507500358684011237604341216194860...', 'output': ['9999999999999644444444444444444422211111111111999999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777777777776666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555554444444444444444444444444444444444444444444444444444444444444444444444433333333333333333333333333333...']}, {'input': '5562193853810918945620627929172131555837473643554362967763887812413927487628705169826152884386226149418373951049986250969308862515359891001338285242920050910490906828048000561263856034031835539717283086698037020184346364592477218030068494838985393388772969774556866175869082513319040937289891361048143148841837267534830052901494206187747905771299059141380597767985198813756458221849136120811572042106826621666519843756406853641666119992871613251441378811527654575794639431472815236597945545443592839760099142175...', 'output': ['9999999999999999999999977777777777777555555999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777666666666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555555555544444444444444444444444444444444444444444444444444444444444444444444444444443333333333333333333333333...']}, {'input': '1730422676082588834860375440897683748061653034160089035356410303853087273043400007064082808873506818021832173796672909286031070430706710420988411005000807994008004024283001700960690091562564065800969314020467274006854259128883092106143502490180340506154995307707013371796800069059205904006180070480509165819304195087071960902368005201049042530842923912727019572672086010287001109827122078050756623098907147400115030307257820452003056013088910107770590352130772036869022135230000406249627027600081343058909708407...', 'output': ['7999999999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777777777777777777777777777777777777777777777777666666666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555555554444444444444444444444444444444444444444444444444444444444444444444444444433333333333333333333333333333333333...']}, {'input': '1188618183388611381111868863636138313333318818183316831361113811386318881168331361688618161613168636818383186336633113388318838136613388313111138111638188133138611181663863163386311813118638838866886113361631311686863836336863366813363683838881686613163833833813818131863311861368333636631363361331668363336363133666111611188181133381186813313311188138316336861381168838138611618113313831613331631133161186833631636661616388613133631666888311386383811818886633183161338681333381366386313631818363861111388386336...', 'output': ['3333333333333333333333333333333333333333111188888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666...', '8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888866666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666333333333333333333333333333333333...']}, {'input': '4243694432732244021095331595848137532367241195639191582163152600248271436184171538206044964067675106064159822875846011534297438582909683899088886549812421326048203391195680776887732457754143569028983164195293260537822023061273285507094731086855967279325960871356767018241344379707565856468765648033087664400397093527921657664579022705211823347324199918200113662278819911280201671779336001809547757878558876551737537928583698853638809689051510513192892880892879923602951533842587693618320930509403954665244464014...', 'output': ['9988888884433229999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555554444...']}, {'input': '5437214130838098132393123187069383986299021704931433096622499682915037838279737829812626065978576360754157333866084773073470536769353978446234788082062466105585127249713791721276273253638073234535447123880003542275055023902223874569552201863700202729293434430147174682302760783914011412039339697895841967107362265388874914846141521997037412954401235418335972353607055044874973461347888021255272429429744517830123078766552437060613565467908259410563840960055743267873948181932990399762986852911078878324107938917...', 'output': ['8888888888888888888888888886666666666666644444444444444444444444444444444444444444444449999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888777777777777777777...']}, {'input': '4944847984484499897477888998874784884474797788999888498989748984997797774478988749487787787944998784444748977844777488984798748984848479947894989998987487879949447848848898888479487898778984788988844874979497894779489449989797494497448984798494794487487499897944798844794498988947898787974874948989778778787978779999884994978894997949747744747987949784774894974798444899479997779484979789977489799448894478894447988489844888844979484789849479784487487984494474787484798944879774787979844984474989994948844498848...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '7688754930503622624249376302050721830065980218099156664541044701341628003496939103577693880283583449467297533469375121979331361424629165453875685841427085813980899970901793449283121463702841677303321796810682892574801165017961242552369171251649136915268463307740719648716991029731139504104601780245826323470355102044393062687794743810560411082474390672510942974815216433066730925915777989481449608904036597675354340429734413866576289385161415247796862427872213476834038054015404274700559772991390769430573604588...', 'output': ['7777777777777777777777777777777777777777777777777777744444333333333333333333333333333333333333311111111111111111111111111111199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6185037014707879384301592707009200430885687987529770162683115103088000085680865822274850080279809974072320607292351515828318654276346545329009080458123889570600021478058963049335300526437402130814087220633083010320092359393947423676191603547547874099010090263715163042641015092023212068194008006284379105933507405589730536098173006808291862017372694644277904949390565867842170703665006250410053210368067399451324395605280164900094231101070015087506700869427482073857397072913460003007919234200185280014042400788...', 'output': ['0999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...', '9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '9965675082563929077799639762147786621291924398160624989369600320192031503878569896057485302667512360792029743474568614205998702183738012739853871916032407255123289056032335037954093166786819460498686316030169623643193583487898113843927174667792205951098904610616262292296460934603477941718344667867924960280476601880750505510840781238530728533026536005269229659829632892079936763214347808150429912908943447565716781168693866762946019658346001623995714859531084238467607308795481083815672444891116656361208045970...', 'output': ['7777777777777777777777766666666666666666666666666666666666666666666666666666664444111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '9399099847230403397608550745456155491158833773727348957376326513008223271678368456249540347230059416611594526577303833136258789778891864775273632464015119183546285134805758447349338707895134660480829159525233548918538910475304570679493939658220667016376015440024476591414811967116176614232543688298600080829981632901950723372865951651419680198089502103871677882895994538059569016616295154550051663786468623844991852957332803481973612908697320851672235286727280608094255910265465949153761572434331191352427728064...', 'output': ['7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777666666666666666444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444441111111111111111111111111111111111111111111111111111111111111999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '8677967897698796789869977698966986766668767667877789687666777969877868866999778969776786886687667966666886998976666676977779778769966697999998779777897676767686769769786987879887997776899999678878889896989896786778987668667889996989798796789766787977696988889666979897677886999868886976889987967696786768799888977677869978788766888766766967966876677799699997999866877688987986667899667687969687976867888778966777679767976979686899989799966976677796988888678867987797979987688869998677678689766966799667798866777...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '9169971377710854296307256878741743698904124875448188271438951731205465267096367879254423883111502855461268175261428259841277349539147022226480518218151857953676017222027859200956811168178482461083232476828773371751606247028165410567693365659977753752229668485142842096080257823565015585554974200804379221344492030870542627558563729072598095907764908903382419976933178549658032518931968565924190202313496291962510432634753675507873015068004621111683336737250908340689201372884809217551652679954580369879266423996...', 'output': ['6999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6402786117688907443629724676831861533380180662220326080501780992805834946738488906845349427183566546511120382042723532624475030689025499486454271766674879981315283125798751257569414757976374038693161455471776288448466249042222232425875808224403027744003704733955856398480964728375104262593788637777991997226599166814909071700171931478113019658198262741949705020331053974720755616818262843218961549805697021892940521399666343560867144526146538816131915538024059710094503485967378568082586947837283236875658146083...', 'output': ['6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666664444444444444444444444444444444444444444444444444444444444444444444444444422222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211111111111111111111111111111111111111111111111111111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '2070584715958145931421943242877190736958188253532149113773257317774198852654268041861390688937915459566813326558023375873717875659623285221404908938186814771148690466010226989170254197736185741906851849474335844294393346935985196002604635838488633689366270270816465659353721056863151769188355135996953267698927714458440941550608272933473999407843409218797782406542610740951897694088643421505259321077956931953401390506157198305673803989694229999834828559332611372520954127118391729272331426793792414035235978292...', 'output': ['6666644444444444444444444444222222222222222222222222221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '8830861889084051137643095774667654091986146869638648806288355834264695705797997204636152837277104079861551043640411014476918595066178670622283784697836347266655410475651455424263984398400662652738282678568304261152268090472444853374162421538590461473160139331604155280883012526754572269223633721300073239964775068679107842867167988931514560036166077584920827099541095153530279147684552577281385808157457305366848324391930843148351467387609038643560823897910018058987387476315080167238324082347653316905346938679...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777666666666666666666666666666666666666666666666666666666666666666666666666666444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444411199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '8305353302042045132812713478589540940020097002309955880051290302345538886542504324100015141590915418707137647116069301978829579921838244596449533937725450722688600320224550552507030093558787751655874747352271037965806257211323568094024519907197752098052106271348046013549239460290417613713576981256525956964865075252410470149725070078486001965401206111081063737511835054192700776299150006487937152257808653940563700849221029782962584151954350056927572215246004027016540143697744783917148900624067210069508161787...', 'output': ['8999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6704583818391588725469181550354102907239957098358358841717401300766278881560400090038110916014289948657235584423606594158621824161523469830236380607965385255791396338932174225438170797034425037147862456636103346837327265294351641494623753674273621107344771242622310334986605935646991773638608552637622046669634226820615541845784212711291886281633637512336684846321599254977042239750805332860293274970565739990902560439745089146186062321750856522530810958656665834465619613523446131577586425662419972532205004271...', 'output': ['4444444444444444444444444444444444444444444444444444443333333333333333333333333333333333333333333333333333333333333333333333333333332222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111099999999999999999999999999999999999999999...', '9444444444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333333333333333333333333333333333333222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111199999999999999999999999999999999999999999...']}, {'input': '9689938698889663898863839636966699683986893699339386968338899966338869996936888869663833336868866886386686639839963333996866369633899638368886998389968998699366836388883663893393688389893963669968369396688338969698386338398836839988388898698688996366986968989699663989989698666833338689688393939988989389688683933989888969993363986386998399368636639933366866638686886936996998988399363868338933366966866996963866669896888669699698386869968968863868939688838383896969669866999369969399938388639699888886838393936...', 'output': ['9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '6023899695120557896013140711187680503448138679874588624050077803801854865697769353263222770960826861606106727886113310607069728272963227255389496899919068931344113537068309946879921059042444576366749994436144274847702102456819164989911861327124734838196173853563309843214631874712516961632171049329502507717957033924841978867659693226643101620967990111518453074600938886866941984226547980772170089838147109088768785941748600078140887848218226465026331411736734765922485300427498987217333097493592537246554457873...', 'output': ['9999999999999999999999888888888888888888888888888888888888888888888888888888888888888888844444444444444444444444444444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333332222222222222222222222222222222222222222222222222222222222222229999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '404\\r\\n', 'output': ['440\\r\\n440']}, {'input': '545\\r\\n', 'output': ['545\\r\\n455']}, {'input': '9090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909...', 'output': ['5999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '1486913458965407214474383051348880508797108309397132594608042047940314727604051381139181936657952113296264075630972575614980513092531236791260521858939901778974029659858701463047070106689549279462422735787009718900006205995325189656713599230841667711463676680976775990350526357505751432136802865972492235528750512640736169514063847705640465671951212885515298612577866350659145039585877518710392780320811778565480073883045746578885361310463306158402059382132691444825799882582584615455011180820034013186375611788...', 'output': ['9999999888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888777777777777777777777777777777777766666666666666666666666666666666666666664444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444449999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '735529000253516066792245888723276479613300890426556306652225805205086728701025634876001325397524812146598588630224764104842665701398105324707149840925039347515712215213069431219974501871104280261909625824309716933706130873817906146976896717670000040952322...', 'output': ['666552222222211111111999999999999999999999999999999999888888888888888888888888888777777777777777777777777777777777777766666666666666666666666666666665555555555555555555555555555555444444444444444444444444444444433333333333333333333333333333332222222222222...']}, {'input': '366006036086560640540664871847076504800540950671092500185010106170000702240791343478023460900266458060030203555013100714501000381575485383858030096600402900030043498189415910634048158764904633057070164811601205632046300331314168080050050942910019130740376...', 'output': ['899999999999999999999999999999999988888888888888888888888888888888888888888888888888877777777777777777777777777777777766666666666666666666666666666666666666666666666666666555555555555555555555555555555555555555555555555555555555444444444444444444444444444...']}, {'input': '398840503220186983858351613394364989756346496319972020357366619510925497280709512558515313910783631554080225450312220220867123106296928778532574514982778097563782084669484471751218108242324646083115319867651232742464770418517086481434481923040543425230711...', 'output': ['999999999999964444444444444444442221111111111199999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777...']}, {'input': '556219385381091894562062792917213155583747364355436296776388781241392748762870516982615288438622614941837395104998625096930886251535989100133828524292005091049090682804800056126385603403183553971728308669803702018434636459247721803006849483898539338877296...', 'output': ['999999999999999999999997777777777777755555599999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777766...']}, {'input': '173042267608258883486037544089768374806165303416008903535641030385308727304340000706408280887350681802183217379667290928603107043070671042098841100500080799400800402428300170096069009156256406580096931402046727400685425912888309210614350249018034050615499...', 'output': ['799999999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888887777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666...']}, {'input': '118861818338861138111186886363613831333331881818331683136111381138631888116833136168861816161316863681838318633663311338831883813661338831311113811163818813313861118166386316338631181311863883886688611336163131168686383633686336681336368383888168661316383...', 'output': ['111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...']}, {'input': '424369443273224402109533159584813753236724119563919158216315260024827143618417153820604496406767510606415982287584601153429743858290968389908888654981242132604820339119568077688773245775414356902898316419529326053782202306127328550709473108685596727932596...', 'output': ['998888888443322999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888877777777777777777777777777777777777777777...']}, {'input': '543721413083809813239312318706938398629902170493143309662249968291503783827973782981262606597857636075415733386608477307347053676935397844623478808206246610558512724971379172127627325363807323453544712388000354227505502390222387456955220186370020272929343...', 'output': ['888888888888888888888888888666666666666664444444444444444444444444444444444444444444444999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '494484798448449989747788899887478488447479778899988849898974898499779777447898874948778778794499878444474897784477748898479874898484847994789498999898748787994944784884889888847948789877898478898884487497949789477948944998979749449744898479849479448748749...', 'output': ['444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}, {'input': '768875493050362262424937630205072183006598021809915666454104470134162800349693910357769388028358344946729753346937512197933136142462916545387568584142708581398089997090179344928312146370284167730332179681068289257480116501796124255236917125164913691526846...', 'output': ['777777777777777777777777777777777777777777777777777774444433333333333333333333333333333333333331111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '618503701470787938430159270700920043088568798752977016268311510308800008568086582227485008027980997407232060729235151582831865427634654532900908045812388957060002147805896304933530052643740213081408722063308301032009235939394742367619160354754787409901009...', 'output': ['099999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '996567508256392907779963976214778662129192439816062498936960032019203150387856989605748530266751236079202974347456861420599870218373801273985387191603240725512328905603233503795409316678681946049868631603016962364319358348789811384392717466779220595109890...', 'output': ['777777777777777777777776666666666666666666666666666666666666666666666666666666444411111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '939909984723040339760855074545615549115883377372734895737632651300822327167836845624954034723005941661159452657730383313625878977889186477527363246401511918354628513480575844734933870789513466048082915952523354891853891047530457067949393965822066701637601...', 'output': ['777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666666666644444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444111111111111111111111111111111111...']}, {'input': '867796789769879678986997769896698676666876766787778968766677796987786886699977896977678688668766796666688699897666667697777977876996669799999877977789767676768676976978698787988799777689999967887888989698989678677898766866788999698979879678976678797769698...', 'output': ['666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666...']}, {'input': '916997137771085429630725687874174369890412487544818827143895173120546526709636787925442388311150285546126817526142825984127734953914702222648051821815185795367601722202785920095681116817848246108323247682877337175160624702816541056769336565997775375222966...', 'output': ['699999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '640278611768890744362972467683186153338018066222032608050178099280583494673848890684534942718356654651112038204272353262447503068902549948645427176667487998131528312579875125756941475797637403869316145547177628844846624904222223242587580822440302774400370...', 'output': ['666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666444444444444444444444444444444444444444444444444444444444444444444444444442222222222222222222222222222222222...']}, {'input': '207058471595814593142194324287719073695818825353214911377325731777419885265426804186139068893791545956681332655802337587371787565962328522140490893818681477114869046601022698917025419773618574190685184947433584429439334693598519600260463583848863368936627...', 'output': ['666664444444444444444444444422222222222222222222222222111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111119999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '883086188908405113764309577466765409198614686963864880628835583426469570579799720463615283727710407986155104364041101447691859506617867062228378469783634726665541047565145542426398439840066265273828267856830426115226809047244485337416242153859046147316013...', 'output': ['999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777766666666666666666666666666666666666666666666666666666666666666666...']}, {'input': '830535330204204513281271347858954094002009700230995588005129030234553888654250432410001514159091541870713764711606930197882957992183824459644953393772545072268860032022455055250703009355878775165587474735227103796580625721132356809402451990719775209805210...', 'output': ['899999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '670458381839158872546918155035410290723995709835835884171740130076627888156040009003811091601428994865723558442360659415862182416152346983023638060796538525579139633893217422543817079703442503714786245663610334683732726529435164149462375367427362110734477...', 'output': ['444444444444444444444444444444444444444444444444444444333333333333333333333333333333333333333333333333333333333333333333333333333333222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211...']}, {'input': '968993869888966389886383963696669968398689369933938696833889996633886999693688886966383333686886688638668663983996333399686636963389963836888699838996899869936683638888366389339368838989396366996836939668833896969838633839883683998838889869868899636698696...', 'output': ['333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333...']}, {'input': '602389969512055789601314071118768050344813867987458862405007780380185486569776935326322277096082686160610672788611331060706972827296322725538949689991906893134411353706830994687992105904244457636674999443614427484770210245681916498991186132712473483819617...', 'output': ['999999999999999999999988888888888888888888888888888888888888888888888888888888888888888884444444444444444444444444444444444444444444444444444444444444444444444444433333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333...']}, {'input': '909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909090909...', 'output': ['599999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...']}, {'input': '126254092095959027850416433832655426981078106611255074552648515499659121878087190358961591096171231715312122879634738062251247629492483043125748065235158236635181790420183641430917548189219521011748435487445986824532619160561716073648857875108255827252014...', 'output': ['888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888884444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444...']}]","id":167} {"description":"Little boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exactly n\u2009+\u20091 bus stops. All of them are numbered with integers from 0 to n in the order in which they follow from Gerald's home. The bus stop by Gerald's home has number 0 and the bus stop by the school has number n.There are m buses running between the house and the school: the i-th bus goes from stop si to ti (si\u2009<\u2009ti), visiting all the intermediate stops in the order in which they follow on the segment. Besides, Gerald's no idiot and he wouldn't get off the bus until it is still possible to ride on it closer to the school (obviously, getting off would be completely pointless). In other words, Gerald can get on the i-th bus on any stop numbered from si to ti\u2009-\u20091 inclusive, but he can get off the i-th bus only on the bus stop ti.Gerald can't walk between the bus stops and he also can't move in the direction from the school to the house.Gerald wants to know how many ways he has to get from home to school. Tell him this number. Two ways are considered different if Gerald crosses some segment between the stops on different buses. As the number of ways can be too much, find the remainder of a division of this number by 1000000007 (109\u2009+\u20097).","input_specification":"The first line contains two space-separated integers: n and m (1\u2009\u2264\u2009n\u2009\u2264\u2009109,\u20090\u2009\u2264\u2009m\u2009\u2264\u2009105). Then follow m lines each containing two integers si,\u2009ti. They are the numbers of starting stops and end stops of the buses (0\u2009\u2264\u2009si\u2009<\u2009ti\u2009\u2264\u2009n).","output_specification":"Print the only number \u2014 the number of ways to get to the school modulo 1000000007 (109\u2009+\u20097).","notes":"NoteThe first test has the only variant to get to school: first on bus number one to the bus stop number one; then on bus number two to the bus stop number two.In the second test no bus goes to the third bus stop, where the school is positioned. Thus, the correct answer is 0.In the third test Gerald can either get or not on any of the first four buses to get closer to the school. Thus, the correct answer is 24\u2009=\u200916.","sample_inputs":["2 2\n0 1\n1 2","3 2\n0 1\n1 2","5 5\n0 1\n0 2\n0 3\n0 4\n0 5"],"sample_outputs":["1","0","16"],"src_uid":"cb47d710361979de0f975cc34fc22c7a","lang_cluster":"Python","difficulty":1700,"human_solution":"a,b=map(int,input().split())\nz=[]\ng=10**9+7\ndef f():\n return map(int,input().split())\nif b==0:\n print (0)\nelse:\n s=set()\n for i in range(b):\n x,y=f()\n z.append((x,y))\n s.add(x)\n s.add(y)\n s.add (0)\n s.add (a)\n s = sorted(list(s))\n a=len(s)-1\n s=dict([(s[j],j) for j in range(a+1)])\n z=[(s[x],s[y]) for (x,y)in z]\n z.sort(key=lambda x:x[1])\n x=[0]*(a+1)\n x[0]=1\n y=[0]*(a+2)\n i=0\n j=0\n for i in range (a+1):\n while j 0:\n\t\t\tres[i] += n \/ q\n\t\t\tq *= primes[i]\n\treturn res\n\ndef c(primes, n, k):\n\treturn div(div(fact(primes, n), fact(primes, k)), fact(primes, n - k))\n\n#cin = open(\"input.txt\", \"rt\")\ncin = sys.stdin\nn, m, h = [int(x) for x in cin.readline().split()]\na = [int(x) for x in cin.readline().split()]\n\nh -= 1\nn -= 1\na[h] -= 1\na[h], a[-1] = a[-1], a[h]\nleft, right = sum(a[:-1]), a[-1]\n\nif left + right < n:\n\tprint -1\n\tsys.exit(0)\nif n > left:\n\tprint 1\n\tsys.exit(0)\t\t\n\nprimes = genPrimes(left + right)\n\nnum = c(primes, left, n)\nden = c(primes, left + right, n)\n\nfor i in range(len(primes)):\n\tv = min(num[i], den[i])\n\tnum[i] -= v\n\tden[i] -= v\n\nans = 1.0\nfor i in range(len(primes)):\n\tfor _ in range(num[i]):\n\t\tans *= primes[i]\n\tfor _ in range(den[i]):\n\t\tans \/= primes[i]\nprint \"%.6f\" % (1.0 - ans)\n","testcases":"[{'input': '3 2 1\\r\\n2 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 2 1\\r\\n1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 2 1\\r\\n2 2\\r\\n', 'output': ['0.666667\\r\\n']}, {'input': '3 2 1\\r\\n1 2\\r\\n', 'output': ['0.000000\\r\\n']}, {'input': '6 5 3\\r\\n5 2 3 10 5\\r\\n', 'output': ['0.380435\\r\\n']}, {'input': '7 10 6\\r\\n9 10 2 3 3 6 9 9 3 7\\r\\n', 'output': ['0.420946\\r\\n']}, {'input': '17 5 1\\r\\n10 4 9 6 2\\r\\n', 'output': ['0.999860\\r\\n']}, {'input': '5 8 3\\r\\n9 7 2 5 2 10 3 4\\r\\n', 'output': ['0.097561\\r\\n']}, {'input': '14 8 4\\r\\n6 2 10 6 2 8 4 2\\r\\n', 'output': ['0.885750\\r\\n']}, {'input': '14 9 9\\r\\n9 4 7 2 1 2 4 3 9\\r\\n', 'output': ['0.971132\\r\\n']}, {'input': '46 73 68\\r\\n4 2 6 4 1 9 8 10 7 8 7 2 6 4 7 9 7 9 9 1 5 1 5 1 8 2 10 2 1 7 10 2 8 3 5 3 8 9 10 5 3 4 10 4 9 6 8 1 1 6 3 1 9 6 9 4 4 3 4 5 8 1 6 2 4 10 5 7 2 6 7 4 2\\r\\n', 'output': ['0.525158\\r\\n']}, {'input': '24 55 54\\r\\n8 3 6 4 8 9 10 2 2 6 6 8 3 4 5 6 6 6 10 4 8 2 3 2 2 2 10 7 10 1 6 1 6 8 10 9 2 8 9 6 6 4 1 2 7 2 2 9 3 7 3 7 6 8 4\\r\\n', 'output': ['0.433479\\r\\n']}, {'input': '63 25 24\\r\\n6 7 7 1 2 5 5 9 9 1 9 8 1 2 10 10 5 10 2 9 5 4 9 5 7\\r\\n', 'output': ['0.891560\\r\\n']}, {'input': '44 94 2\\r\\n2 4 10 9 5 1 9 8 1 3 6 5 5 9 4 6 6 2 6 2 4 5 7 3 8 6 5 10 2 1 1 9 1 9 3 1 9 6 2 4 9 7 4 6 1 4 5 2 7 8 2 1 1 1 4 2 5 5 5 8 2 8 2 1 1 8 1 7 7 7 1 2 5 3 8 9 8 7 2 10 5 2 2 8 9 1 4 7 7 2 6 2 8 5\\r\\n', 'output': ['0.259627\\r\\n']}, {'input': '44 35 7\\r\\n10 2 2 6 4 2 8 3 10 1 9 9 7 9 10 6 6 1 4 5 7 4 9 7 10 10 7 9 6 1 7 7 2 10 7\\r\\n', 'output': ['0.793743\\r\\n']}, {'input': '27 47 44\\r\\n8 5 2 5 10 6 7 9 5 10 8 5 9 5 10 5 10 8 5 1 1 2 2 10 3 2 5 9 6 3 3 1 5 4 10 5 2 2 4 4 4 4 4 1 1 3 7\\r\\n', 'output': ['0.000000\\r\\n']}, {'input': '21 67 49\\r\\n4 4 3 5 7 5 10 2 8 5 2 2 6 3 6 2 8 6 2 6 2 9 3 3 4 1 9 9 3 3 6 3 6 7 8 9 10 6 10 5 1 5 2 3 3 9 10 5 10 7 1 6 4 5 4 7 8 5 4 2 9 3 3 5 7 1 10\\r\\n', 'output': ['0.414860\\r\\n']}, {'input': '42 71 67\\r\\n2 1 4 1 10 5 1 8 8 5 2 1 1 7 2 2 8 10 8 2 10 8 2 2 9 6 5 10 7 1 7 2 10 3 5 6 10 10 4 6 10 5 6 6 9 4 1 6 1 8 10 6 1 5 3 2 4 1 8 5 10 10 9 3 10 7 5 9 1 9 3\\r\\n', 'output': ['0.362240\\r\\n']}, {'input': '50 93 28\\r\\n2 5 9 5 5 8 1 3 9 2 7 10 3 1 10 10 8 5 2 7 5 4 3 9 5 2 8 9 10 8 2 7 8 9 8 1 9 8 4 3 3 6 10 10 1 2 10 1 8 10 5 8 5 2 4 1 5 6 9 8 6 7 4 6 6 1 5 1 4 6 8 4 1 7 2 8 7 5 1 3 3 7 4 2 1 5 7 5 8 3 8 7 2\\r\\n', 'output': ['0.563739\\r\\n']}, {'input': '33 90 4\\r\\n5 10 2 3 9 6 9 3 3 8 6 4 8 4 9 3 5 9 5 6 4 1 10 6 4 5 4 5 9 5 7 1 3 9 6 6 5 6 2 4 8 7 8 5 4 5 10 9 3 1 1 8 6 9 5 1 5 9 4 6 6 4 9 4 5 7 3 7 9 1 5 6 4 1 1 4 2 4 4 2 6 4 5 5 4 9 1 10 2 2\\r\\n', 'output': ['0.132213\\r\\n']}, {'input': '65 173 136\\r\\n26 18 8 11 1 22 44 6 15 22 13 49 30 36 37 41 25 27 9 36 36 1 45 20 7 47 28 30 30 21 33 32 9 11 16 5 19 12 44 40 25 40 32 36 15 34 4 43 28 19 29 33 7 11 18 13 40 18 10 26 1 48 20 38 1 20 34 8 46 8 32 35 16 49 26 36 11 16 4 29 35 44 14 21 22 42 10 1 3 12 35 30 14 45 2 24 32 15 2 28 35 17 48 31 7 26 44 43 37 4 14 26 25 41 18 40 15 32 16 7 40 22 43 8 25 21 35 21 47 45 7 21 50 38 23 13 4 49 10 27 31 38 43 40 10 24 39 35 31 33 9 6 15 18 2 14 20 14 12 12 29 47 9 49 25 17 41 35 9 40 19 50 34\\r\\n', 'output': ['0.165731\\r\\n']}, {'input': '77 155 26\\r\\n15 18 38 46 13 15 43 37 36 28 22 26 9 46 14 32 20 11 8 28 20 42 38 40 31 20 2 43 1 42 25 28 40 47 6 50 42 45 36 28 38 43 31 14 9 22 49 4 41 9 24 35 38 40 19 31 4 9 13 19 15 48 2 34 46 49 41 15 13 29 15 24 15 50 8 26 10 23 24 15 2 46 47 46 25 36 41 29 44 36 24 22 41 7 48 17 42 41 4 46 15 26 48 27 35 19 35 22 47 7 40 1 15 46 6 34 44 6 9 5 29 24 5 25 12 38 46 10 35 12 8 15 1 9 1 16 2 12 24 31 37 49 27 41 33 5 26 48 42 37 20 18 49 40 16\\r\\n', 'output': ['0.299854\\r\\n']}, {'input': '67 108 14\\r\\n33 40 13 10 26 31 27 24 48 1 42 28 38 29 9 28 48 41 12 19 27 50 6 45 46 7 34 47 8 18 40 27 42 4 33 3 10 25 10 29 39 3 5 39 1 17 40 10 6 8 41 50 27 43 40 42 43 25 18 34 6 15 5 9 11 37 13 4 16 25 49 33 14 40 13 16 50 24 4 43 45 12 31 38 40 36 3 4 4 19 18 12 20 44 4 44 8 50 21 5 44 34 9 9 6 39 43 21\\r\\n', 'output': ['0.504558\\r\\n']}, {'input': '82 135 73\\r\\n22 18 8 45 35 8 19 46 40 6 30 40 10 41 43 38 41 40 1 43 19 23 5 13 29 16 30 9 4 42 42 3 24 16 21 26 5 4 24 24 31 30 1 10 45 50 33 21 21 47 42 37 47 15 30 23 4 2 28 15 38 33 45 30 31 32 6 14 6 4 39 12 50 29 26 45 19 12 40 4 33 9 16 12 44 36 47 42 43 17 18 12 12 42 45 38 6 10 19 10 14 31 6 21 2 15 21 26 5 3 3 6 6 22 44 48 9 11 33 31 34 43 39 40 48 26 1 29 48 11 22 38 23 11 20\\r\\n', 'output': ['0.706768\\r\\n']}, {'input': '73 121 102\\r\\n11 21 12 1 48 30 22 42 42 35 33 12 23 11 27 15 50 49 24 2 48 2 21 32 16 48 36 26 32 13 38 46 36 15 27 24 7 21 43 49 19 13 3 41 35 17 5 22 42 19 37 20 40 42 11 31 48 16 21 5 42 23 29 44 9 30 46 21 44 27 9 17 39 24 30 33 48 3 43 18 16 18 17 46 19 26 37 5 24 36 42 12 18 29 7 49 1 9 27 12 21 29 19 38 6 19 43 46 33 42 9 30 19 38 25 10 44 23 50 25 46\\r\\n', 'output': ['0.470538\\r\\n']}, {'input': '50 113 86\\r\\n2 17 43 22 48 40 42 47 32 29 10 4 9 14 20 50 8 29 12 11 50 41 3 22 30 4 48 37 27 19 50 50 23 34 13 21 3 36 31 39 22 27 7 21 31 21 14 18 36 19 27 42 19 8 5 41 7 8 22 40 38 32 44 25 21 48 4 12 10 16 23 30 25 41 16 45 3 26 19 34 34 25 26 6 9 21 46 33 36 45 3 13 28 44 30 29 22 41 20 1 20 38 4 33 36 15 41 18 13 11 13 18 6\\r\\n', 'output': ['0.298885\\r\\n']}, {'input': '74 146 112\\r\\n10 31 40 32 9 17 31 26 32 7 20 18 50 10 15 28 6 41 21 27 11 5 14 36 48 45 10 42 45 40 4 11 41 23 47 31 34 4 42 49 48 9 37 34 25 27 30 27 44 33 30 25 22 13 25 41 8 34 32 22 11 12 32 9 37 9 42 7 37 13 20 40 28 26 2 6 2 49 41 46 11 9 32 18 43 28 39 48 45 36 18 10 28 35 26 5 20 12 16 2 34 28 31 13 18 39 40 1 39 12 33 31 1 31 46 1 47 38 39 49 32 12 2 8 16 27 48 41 16 27 38 42 21 27 26 8 31 41 20 43 47 5 39 25 47 34\\r\\n', 'output': ['0.437111\\r\\n']}, {'input': '78 124 41\\r\\n5 28 46 46 13 48 36 2 28 31 31 12 9 28 40 35 34 50 50 30 17 11 6 36 16 30 29 8 18 16 21 8 15 30 29 20 12 5 29 20 11 44 12 42 49 10 11 7 25 15 2 38 30 29 17 34 4 5 44 49 25 15 16 33 26 8 8 34 21 9 33 16 14 8 43 50 45 17 15 43 44 22 37 36 22 47 6 13 49 48 37 44 50 9 35 13 38 31 15 6 35 48 22 14 18 8 40 18 4 23 2 26 41 41 27 40 43 33 2 17 11 40 42 32\\r\\n', 'output': ['0.218709\\r\\n']}, {'input': '51 153 26\\r\\n19 32 28 7 25 50 22 31 29 39 5 4 28 26 24 1 19 23 36 2 50 50 33 28 15 17 31 35 10 40 16 7 6 43 50 29 20 25 31 37 10 18 38 38 44 30 36 47 37 6 16 48 41 49 14 16 30 7 29 42 36 8 31 37 26 15 43 42 32 3 46 12 16 37 33 12 18 16 15 14 46 11 2 50 34 34 34 32 28 24 44 12 9 38 35 12 11 15 2 6 28 35 14 46 25 30 9 1 26 5 35 26 4 32 2 30 36 29 22 4 5 1 44 38 6 48 48 6 43 45 24 19 44 18 37 18 40 45 25 35 20 27 21 29 43 18 26 46 22 39 29 41 1\\r\\n', 'output': ['0.183488\\r\\n']}, {'input': '100 10 5\\r\\n10 8 7 5 8 1 2 4 3 10\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 10 8\\r\\n1 8 9 7 6 4 4 6 8 5\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1\\r\\n1\\r\\n', 'output': ['0.000000\\r\\n']}, {'input': '1 1 1\\r\\n2\\r\\n', 'output': ['0.000000\\r\\n']}, {'input': '1 1 1\\r\\n100\\r\\n', 'output': ['0.000000\\r\\n']}, {'input': '100 1 1\\r\\n100\\r\\n', 'output': ['1\\r\\n']}, {'input': '99 1 1\\r\\n100\\r\\n', 'output': ['1\\r\\n']}, {'input': '100 2 1\\r\\n100 1\\r\\n', 'output': ['1\\r\\n']}]","id":169} {"description":"Piet is one of the most known visual esoteric programming languages. The programs in Piet are constructed from colorful blocks of pixels and interpreted using pretty complicated rules. In this problem we will use a subset of Piet language with simplified rules.The program will be a rectangular image consisting of colored and black pixels. The color of each pixel will be given by an integer number between 0 and 9, inclusive, with 0 denoting black. A block of pixels is defined as a rectangle of pixels of the same color (not black). It is guaranteed that all connected groups of colored pixels of the same color will form rectangular blocks. Groups of black pixels can form arbitrary shapes.The program is interpreted using movement of instruction pointer (IP) which consists of three parts: current block pointer (BP); note that there is no concept of current pixel within the block; direction pointer (DP) which can point left, right, up or down; block chooser (CP) which can point to the left or to the right from the direction given by DP; in absolute values CP can differ from DP by 90 degrees counterclockwise or clockwise, respectively.Initially BP points to the block which contains the top-left corner of the program, DP points to the right, and CP points to the left (see the orange square on the image below).One step of program interpretation changes the state of IP in a following way. The interpreter finds the furthest edge of the current color block in the direction of the DP. From all pixels that form this edge, the interpreter selects the furthest one in the direction of CP. After this, BP attempts to move from this pixel into the next one in the direction of DP. If the next pixel belongs to a colored block, this block becomes the current one, and two other parts of IP stay the same. It the next pixel is black or outside of the program, BP stays the same but two other parts of IP change. If CP was pointing to the left, now it points to the right, and DP stays the same. If CP was pointing to the right, now it points to the left, and DP is rotated 90 degrees clockwise.This way BP will never point to a black block (it is guaranteed that top-left pixel of the program will not be black).You are given a Piet program. You have to figure out which block of the program will be current after n steps.","input_specification":"The first line of the input contains two integer numbers m (1\u2009\u2264\u2009m\u2009\u2264\u200950) and n (1\u2009\u2264\u2009n\u2009\u2264\u20095\u00b7107). Next m lines contain the rows of the program. All the lines have the same length between 1 and 50 pixels, and consist of characters 0-9. The first character of the first line will not be equal to 0.","output_specification":"Output the color of the block which will be current after n steps of program interpretation.","notes":"NoteIn the first example IP changes in the following way. After step 1 block 2 becomes current one and stays it after two more steps. After step 4 BP moves to block 3, after step 7 \u2014 to block 4, and finally after step 10 BP returns to block 1. The sequence of states of IP is shown on the image: the arrows are traversed clockwise, the main arrow shows direction of DP, the side one \u2014 the direction of CP.","sample_inputs":["2 10\n12\n43","3 12\n1423\n6624\n6625","5 9\n10345\n23456\n34567\n45678\n56789"],"sample_outputs":["1","6","5"],"src_uid":"09249ddeefb69734c50f9df3222ec7cb","lang_cluster":"Python","difficulty":2100,"human_solution":"class Piet:\n inc = [{'x':0,'y':-1},{'x':1,'y':0},{'x':0,'y':1},{'x':-1,'y':0}]\n def __init__(self):\n self.BP = {'x':0,'y':0}\n self.DP = 1\n self.CP = 0\n self.getdata()\n self.go()\n def getdata(self):\n in_line = raw_input().split()\n self.m = int(in_line[0])\n self.n = int(in_line[1])\n self.pixels = []\n for i in range(self.m):\n self.pixels.append(raw_input())\n def is_out_limit(self,x,y):\n if x >= len(self.pixels[0]) or y >= self.m or x<0 or y<0:\n return True\n else:\n return False\n def go(self):\n ans = []\n info = []\n for t in xrange(self.n):\n while True:\n if self.is_out_limit(self.BP['x']+Piet.inc[self.DP]['x'],self.BP['y']+Piet.inc[self.DP]['y']):\n break\n curr_color = self.pixels[self.BP['y']][self.BP['x']]\n new_color = self.pixels[self.BP['y']+Piet.inc[self.DP]['y']][self.BP['x']+Piet.inc[self.DP]['x']]\n if curr_color == new_color:\n self.BP['x'] += Piet.inc[self.DP]['x']\n self.BP['y'] += Piet.inc[self.DP]['y']\n else:\n break\n while True:\n if self.is_out_limit(self.BP['x']+Piet.inc[self.CP]['x'],self.BP['y']+Piet.inc[self.CP]['y']):\n break\n curr_color = self.pixels[self.BP['y']][self.BP['x']]\n new_color = self.pixels[self.BP['y']+Piet.inc[self.CP]['y']][self.BP['x']+Piet.inc[self.CP]['x']]\n if curr_color == new_color:\n self.BP['x'] += Piet.inc[self.CP]['x']\n self.BP['y'] += Piet.inc[self.CP]['y']\n else:\n break\n if self.is_out_limit(self.BP['x']+Piet.inc[self.DP]['x'],self.BP['y']+Piet.inc[self.DP]['y']) or self.pixels[self.BP['y']+Piet.inc[self.DP]['y']][self.BP['x']+Piet.inc[self.DP]['x']] == '0':\n if self.DP == (self.CP + 1)%4:\n self.CP = (self.CP + 2)%4\n else:\n self.DP = (self.DP + 1)%4\n self.CP = (self.DP - 1)%4\n else:\n self.BP['x'] += Piet.inc[self.DP]['x']\n self.BP['y'] += Piet.inc[self.DP]['y']\n #print(self.BP['x'],self.BP['y'],self.DP,self.CP)\n if (self.BP['x'],self.BP['y'],self.DP,self.CP) in info:\n dot = info.index( (self.BP['x'],self.BP['y'],self.DP,self.CP) )\n print ans[dot-1+(self.n-dot)%(len(ans)-dot)]\n break\n else:\n ans.append(self.pixels[self.BP['y']][self.BP['x']])\n info.append( (self.BP['x'],self.BP['y'],self.DP,self.CP) )\n else:\n print ans[-1]\n\ndef main():\n p = Piet()\n\nif __name__ == '__main__':\n main()\n","testcases":"[{'input': '2 10\\r\\n12\\r\\n43\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 12\\r\\n1423\\r\\n6624\\r\\n6625\\r\\n', 'output': ['6\\r\\n']}, {'input': '5 9\\r\\n10345\\r\\n23456\\r\\n34567\\r\\n45678\\r\\n56789\\r\\n', 'output': ['5\\r\\n']}, {'input': '4 1000000\\r\\n444444444\\r\\n444444444\\r\\n444444444\\r\\n444444444\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 7\\r\\n901\\r\\n922\\r\\n934\\r\\n', 'output': ['3\\r\\n']}, {'input': '3 9\\r\\n888\\r\\n456\\r\\n226\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 9\\r\\n777\\r\\n120\\r\\n345\\r\\n', 'output': ['1\\r\\n']}, {'input': '3 6\\r\\n122\\r\\n322\\r\\n000\\r\\n', 'output': ['3\\r\\n']}, {'input': '3 7\\r\\n922\\r\\n322\\r\\n022\\r\\n', 'output': ['9\\r\\n']}, {'input': '3 12\\r\\n123\\r\\n045\\r\\n666\\r\\n', 'output': ['5\\r\\n']}, {'input': '3 22\\r\\n1111\\r\\n0273\\r\\n4443\\r\\n', 'output': ['7\\r\\n']}, {'input': '5 1000000\\r\\n11100\\r\\n00200\\r\\n03330\\r\\n03330\\r\\n00000\\r\\n', 'output': ['3\\r\\n']}, {'input': '4 9995\\r\\n11122\\r\\n06330\\r\\n04470\\r\\n55800\\r\\n', 'output': ['3\\r\\n']}, {'input': '9 1000000\\r\\n123456789\\r\\n032567891\\r\\n345678902\\r\\n456789123\\r\\n567891234\\r\\n678912345\\r\\n789123456\\r\\n891234067\\r\\n912345678\\r\\n', 'output': ['3\\r\\n']}, {'input': '1 10\\r\\n8\\r\\n', 'output': ['8\\r\\n']}, {'input': '50 180667\\r\\n3\\r\\n8\\r\\n3\\r\\n6\\r\\n5\\r\\n6\\r\\n1\\r\\n9\\r\\n6\\r\\n7\\r\\n6\\r\\n3\\r\\n2\\r\\n9\\r\\n7\\r\\n8\\r\\n6\\r\\n3\\r\\n2\\r\\n5\\r\\n6\\r\\n7\\r\\n3\\r\\n7\\r\\n8\\r\\n2\\r\\n1\\r\\n7\\r\\n9\\r\\n4\\r\\n1\\r\\n2\\r\\n4\\r\\n3\\r\\n8\\r\\n9\\r\\n5\\r\\n9\\r\\n8\\r\\n9\\r\\n1\\r\\n4\\r\\n1\\r\\n5\\r\\n1\\r\\n9\\r\\n7\\r\\n3\\r\\n9\\r\\n8\\r\\n', 'output': ['4\\r\\n']}, {'input': '1 85699\\r\\n78924219635752981967414898939315271493564548581817\\r\\n', 'output': ['7\\r\\n']}, {'input': '15 357307\\r\\n666662222299999333337777700000\\r\\n666662222299999333337777700000\\r\\n666662222299999333337777700000\\r\\n666662222299999333337777700000\\r\\n666662222299999333337777700000\\r\\n222221111100000111115555566666\\r\\n222221111100000111115555566666\\r\\n222221111100000111115555566666\\r\\n222221111100000111115555566666\\r\\n222221111100000111115555566666\\r\\n000001111188888444441111144444\\r\\n000001111188888444441111144444\\r\\n000001111188888444441111144444\\r\\n000001111188888444441111144444\\r\\n000001111188888444441111144444\\r\\n', 'output': ['8\\r\\n']}, {'input': '8 194869\\r\\n6644\\r\\n6644\\r\\n0077\\r\\n0077\\r\\n2255\\r\\n2255\\r\\n6600\\r\\n6600\\r\\n', 'output': ['2\\r\\n']}, {'input': '3 951706\\r\\n777111111111999444777555222555222666666999\\r\\n777111111111999444777555222555222666666999\\r\\n777111111111999444777555222555222666666999\\r\\n', 'output': ['9\\r\\n']}, {'input': '23 742870\\r\\n377777338888888888\\r\\n111111338888888888\\r\\n111111338888888888\\r\\n111111338888888888\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n111111335555555559\\r\\n', 'output': ['9\\r\\n']}, {'input': '12 534024\\r\\n66666999991175\\r\\n66666999991175\\r\\n66666999991175\\r\\n66666999993372\\r\\n66666999993316\\r\\n66666999993394\\r\\n66666999993392\\r\\n66666999993305\\r\\n66666999993305\\r\\n66666999993309\\r\\n66666999993303\\r\\n66666999993305\\r\\n', 'output': ['6\\r\\n']}, {'input': '12 899884\\r\\n70499\\r\\n70499\\r\\n75499\\r\\n75499\\r\\n75499\\r\\n75499\\r\\n70499\\r\\n70499\\r\\n00499\\r\\n03499\\r\\n00499\\r\\n00499\\r\\n', 'output': ['7\\r\\n']}, {'input': '8 215240\\r\\n888888888888884433333\\r\\n888888888888884455555\\r\\n222222222222221166077\\r\\n222222222222220222222\\r\\n222222222222220222222\\r\\n222222222222220222222\\r\\n488888888888888888888\\r\\n999999949211933222779\\r\\n', 'output': ['4\\r\\n']}, {'input': '15 6394\\r\\n55958\\r\\n55158\\r\\n55158\\r\\n55158\\r\\n55158\\r\\n66158\\r\\n66158\\r\\n66158\\r\\n22158\\r\\n22158\\r\\n22128\\r\\n22128\\r\\n22128\\r\\n22728\\r\\n22728\\r\\n', 'output': ['2\\r\\n']}, {'input': '30 279591\\r\\n811113337\\r\\n811119997\\r\\n811119997\\r\\n411119997\\r\\n411119997\\r\\n411119997\\r\\n411119997\\r\\n411119990\\r\\n411110777\\r\\n011119777\\r\\n011119777\\r\\n011119777\\r\\n888889777\\r\\n888889116\\r\\n888889117\\r\\n888881887\\r\\n888881887\\r\\n888881887\\r\\n888881887\\r\\n888889997\\r\\n888889997\\r\\n888889997\\r\\n055559997\\r\\n855559997\\r\\n811119997\\r\\n811119997\\r\\n811119997\\r\\n811119997\\r\\n588889997\\r\\n588889997\\r\\n', 'output': ['8\\r\\n']}, {'input': '49 749442\\r\\n8888888\\r\\n8888888\\r\\n8888888\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5111111\\r\\n5111111\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n', 'output': ['6\\r\\n']}, {'input': '31 70745\\r\\n90016\\r\\n60016\\r\\n00016\\r\\n30016\\r\\n30016\\r\\n30013\\r\\n30013\\r\\n90014\\r\\n30014\\r\\n30014\\r\\n20014\\r\\n20014\\r\\n80014\\r\\n80014\\r\\n80016\\r\\n80016\\r\\n80016\\r\\n80016\\r\\n80016\\r\\n80013\\r\\n80013\\r\\n80016\\r\\n00016\\r\\n00016\\r\\n00016\\r\\n00016\\r\\n50016\\r\\n90016\\r\\n90016\\r\\n90016\\r\\n90016\\r\\n', 'output': ['6\\r\\n']}, {'input': '16 714827\\r\\n33333885555555555199311111111\\r\\n33333885555555555199377777774\\r\\n33333965555555555166377777774\\r\\n99111112222222222166377777774\\r\\n55555555555555543423877777774\\r\\n55555555555555543423977777774\\r\\n55555555555555577777077777774\\r\\n55555555555555577777077777774\\r\\n55555555555555511111177777774\\r\\n55555555555555511111177777774\\r\\n55555555555555511111177777774\\r\\n55555555555555511111177777774\\r\\n99999999999999999999977777774\\r\\n22222222222222222222277777774\\r\\n22222222222222222222277777774\\r\\n22222222222222222222277777774\\r\\n', 'output': ['1\\r\\n']}, {'input': '28 392042\\r\\n555555555\\r\\n444044444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n522744444\\r\\n522744444\\r\\n509644444\\r\\n888882290\\r\\n888882290\\r\\n888882290\\r\\n888882290\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n555555555\\r\\n555555555\\r\\n555555555\\r\\n111111111\\r\\n111111111\\r\\n', 'output': ['5\\r\\n']}, {'input': '11 988024\\r\\n511111\\r\\n455555\\r\\n088883\\r\\n222227\\r\\n222228\\r\\n222221\\r\\n222221\\r\\n888881\\r\\n888886\\r\\n888883\\r\\n888883\\r\\n', 'output': ['5\\r\\n']}, {'input': '14 309330\\r\\n5998837733\\r\\n5998837733\\r\\n7998837733\\r\\n7998807733\\r\\n7998807733\\r\\n7998807733\\r\\n7885507733\\r\\n7885507733\\r\\n4885507733\\r\\n4885507733\\r\\n4885592233\\r\\n5885527777\\r\\n3885527777\\r\\n4444427777\\r\\n', 'output': ['5\\r\\n']}, {'input': '16 50000000\\r\\n33333885555555555199311111111\\r\\n33333885555555555199377777774\\r\\n33333965555555555166377777774\\r\\n99111112222222222166377777774\\r\\n55555555555555543423877777774\\r\\n55555555555555543423977777774\\r\\n55555555555555577777077777774\\r\\n55555555555555577777077777774\\r\\n55555555555555511111177777774\\r\\n55555555555555511111177777774\\r\\n55555555555555511111177777774\\r\\n55555555555555511111177777774\\r\\n99999999999999999999977777774\\r\\n22222222222222222222277777774\\r\\n22222222222222222222277777774\\r\\n22222222222222222222277777774\\r\\n', 'output': ['1\\r\\n']}, {'input': '28 50000000\\r\\n555555555\\r\\n444044444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n999944444\\r\\n522744444\\r\\n522744444\\r\\n509644444\\r\\n888882290\\r\\n888882290\\r\\n888882290\\r\\n888882290\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n888882233\\r\\n555555555\\r\\n555555555\\r\\n555555555\\r\\n111111111\\r\\n111111111\\r\\n', 'output': ['9\\r\\n']}, {'input': '11 50000000\\r\\n511111\\r\\n455555\\r\\n088883\\r\\n222227\\r\\n222228\\r\\n222221\\r\\n222221\\r\\n888881\\r\\n888886\\r\\n888883\\r\\n888883\\r\\n', 'output': ['1\\r\\n']}, {'input': '14 50000000\\r\\n5998837733\\r\\n5998837733\\r\\n7998837733\\r\\n7998807733\\r\\n7998807733\\r\\n7998807733\\r\\n7885507733\\r\\n7885507733\\r\\n4885507733\\r\\n4885507733\\r\\n4885592233\\r\\n5885527777\\r\\n3885527777\\r\\n4444427777\\r\\n', 'output': ['7\\r\\n']}, {'input': '15 50000000\\r\\n55958\\r\\n55158\\r\\n55158\\r\\n55158\\r\\n55158\\r\\n66158\\r\\n66158\\r\\n66158\\r\\n22158\\r\\n22158\\r\\n22128\\r\\n22128\\r\\n22128\\r\\n22728\\r\\n22728\\r\\n', 'output': ['5\\r\\n']}, {'input': '30 50000000\\r\\n811113337\\r\\n811119997\\r\\n811119997\\r\\n411119997\\r\\n411119997\\r\\n411119997\\r\\n411119997\\r\\n411119990\\r\\n411110777\\r\\n011119777\\r\\n011119777\\r\\n011119777\\r\\n888889777\\r\\n888889116\\r\\n888889117\\r\\n888881887\\r\\n888881887\\r\\n888881887\\r\\n888881887\\r\\n888889997\\r\\n888889997\\r\\n888889997\\r\\n055559997\\r\\n855559997\\r\\n811119997\\r\\n811119997\\r\\n811119997\\r\\n811119997\\r\\n588889997\\r\\n588889997\\r\\n', 'output': ['9\\r\\n']}, {'input': '49 50000000\\r\\n8888888\\r\\n8888888\\r\\n8888888\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5777777\\r\\n5111111\\r\\n5111111\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n5666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n0666666\\r\\n', 'output': ['8\\r\\n']}, {'input': '31 50000000\\r\\n90016\\r\\n60016\\r\\n00016\\r\\n30016\\r\\n30016\\r\\n30013\\r\\n30013\\r\\n90014\\r\\n30014\\r\\n30014\\r\\n20014\\r\\n20014\\r\\n80014\\r\\n80014\\r\\n80016\\r\\n80016\\r\\n80016\\r\\n80016\\r\\n80016\\r\\n80013\\r\\n80013\\r\\n80016\\r\\n00016\\r\\n00016\\r\\n00016\\r\\n00016\\r\\n50016\\r\\n90016\\r\\n90016\\r\\n90016\\r\\n90016\\r\\n', 'output': ['9\\r\\n']}]","id":170} {"description":"There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was decided as well that it is necessary to include into the exposition only those books that were published during a particular time period. It is obvious that if the books differ much in size, the visitors will not like it. That was why the organizers came to the opinion, that the difference between the highest and the lowest books in the exposition should be not more than k millimeters.The library has n volumes of books by Berlbury, arranged in chronological order of their appearance. The height of each book in millimeters is know, it is hi. As Berlbury is highly respected in the city, the organizers want to include into the exposition as many books as possible, and to find out what periods of his creative work they will manage to cover. You are asked to help the organizers cope with this hard task.","input_specification":"The first line of the input data contains two integer numbers separated by a space n (1\u2009\u2264\u2009n\u2009\u2264\u2009105) and k (0\u2009\u2264\u2009k\u2009\u2264\u2009106) \u2014 the amount of books by Berlbury in the library, and the maximum allowed height difference between the lowest and the highest books. The second line contains n integer numbers separated by a space. Each number hi (1\u2009\u2264\u2009hi\u2009\u2264\u2009106) is the height of the i-th book in millimeters.","output_specification":"In the first line of the output data print two numbers a and b (separate them by a space), where a is the maximum amount of books the organizers can include into the exposition, and b \u2014 the amount of the time periods, during which Berlbury published a books, and the height difference between the lowest and the highest among these books is not more than k milllimeters. In each of the following b lines print two integer numbers separated by a space \u2014 indexes of the first and the last volumes from each of the required time periods of Berlbury's creative work.","notes":null,"sample_inputs":["3 3\n14 12 10","2 0\n10 10","4 5\n8 19 10 13"],"sample_outputs":["2 2\n1 2\n2 3","2 1\n1 2","2 1\n3 4"],"src_uid":"bc8b4b74c2f2d486e2d2f03982ef1013","lang_cluster":"Python","difficulty":1900,"human_solution":"from bisect import *\nn,k=map(int,input().split())\nh=list(map(int,input().split()))\nl=[]\nq=[]\naa=-1\nj=0\nfor i in range(n):\n l.insert(bisect(l,h[i]),h[i])\n while l[-1]-l[0]>k:\n l.pop(bisect(l,h[j])-1)\n j+=1\n if i-j+1>aa:\n aa=i-j+1\n q=[]\n if i-j+1==aa:\n q.append([j+1,i+1])\nprint(aa,len(q))\nfor i in q:\n print(i[0],i[1])","testcases":"[{'input': '3 3\\r\\n14 12 10\\r\\n', 'output': ['2 2\\r\\n1 2\\r\\n2 3\\r\\n']}, {'input': '2 0\\r\\n10 10\\r\\n', 'output': ['2 1\\r\\n1 2\\r\\n']}, {'input': '4 5\\r\\n8 19 10 13\\r\\n', 'output': ['2 1\\r\\n3 4\\r\\n']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['1 1\\r\\n1 1\\r\\n']}, {'input': '2 10\\r\\n35 45\\r\\n', 'output': ['2 1\\r\\n1 2\\r\\n']}, {'input': '4 8\\r\\n89 33 54 75\\r\\n', 'output': ['1 4\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n']}, {'input': '5 1\\r\\n9 6 8 7 5\\r\\n', 'output': ['2 1\\r\\n3 4\\r\\n']}, {'input': '3 3\\r\\n3 8 6\\r\\n', 'output': ['2 1\\r\\n2 3\\r\\n']}, {'input': '4 1000000\\r\\n100001 1 200001 300001\\r\\n', 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': '4 1000\\r\\n11497 9999 10730 12280\\r\\n', 'output': ['2 1\\r\\n2 3\\r\\n']}, {'input': '3 0\\r\\n1000000 1000000 1000000\\r\\n', 'output': ['3 1\\r\\n1 3\\r\\n']}, {'input': '4 50\\r\\n165 182 157 132\\r\\n', 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': '5 173\\r\\n350 250 200 300 400\\r\\n', 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': '4 0\\r\\n1 1 1 1\\r\\n', 'output': ['4 1\\r\\n1 4\\r\\n']}, {'input': '2 1000000\\r\\n1 1000000\\r\\n', 'output': ['2 1\\r\\n1 2\\r\\n']}, {'input': '7 14\\r\\n28 28 29 35 25 29 28\\r\\n', 'output': ['7 1\\r\\n1 7\\r\\n']}, {'input': '10 163\\r\\n7541 2535 5883 5775 2821 5962 4489 5548 2852 4595\\r\\n', 'output': ['2 1\\r\\n3 4\\r\\n']}, {'input': '15 793\\r\\n98580 27440 3719 73977 34819 64092 89939 75329 72884 66502 17464 73662 6666 47984 45348\\r\\n', 'output': ['1 15\\r\\n1 1\\r\\n2 2\\r\\n3 3\\r\\n4 4\\r\\n5 5\\r\\n6 6\\r\\n7 7\\r\\n8 8\\r\\n9 9\\r\\n10 10\\r\\n11 11\\r\\n12 12\\r\\n13 13\\r\\n14 14\\r\\n15 15\\r\\n']}, {'input': '28 543\\r\\n1921 1700 1363 2580 2693 3144 2269 908 3863 3750 2151 3039 1581 3395 1133 1804 1464 2040 2372 2475 1240 800 3521 3270 2815 1026 3625 2930\\r\\n', 'output': ['3 1\\r\\n18 20\\r\\n']}, {'input': '55 1000\\r\\n2612 1306 4300 1790 3173 9493 7209 7763 8563 4534 7466 1281 4483 6863 3787 7292 3957 8775 7221 4016 5743 6556 2070 2119 4795 9094 1913 2077 8786 4520 1865 2357 7871 3288 8231 5808 9383 9820 9974 3056 5343 2169 5177 6299 5805 8132 9315 6747 5226 3531 1206 4073 8290 1423 6720\\r\\n', 'output': ['3 1\\r\\n37 39\\r\\n']}]","id":171} {"description":"Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a programmed device. It always moves along the same trajectory, which is a polyline with vertices at the points (x0,\u2009y0,\u2009z0), (x1,\u2009y1,\u2009z1), ..., (xn,\u2009yn,\u2009zn). At the beginning of the game the snitch is positioned at the point (x0,\u2009y0,\u2009z0), and then moves along the polyline at the constant speed vs. The twins have not yet found out how the snitch behaves then. Nevertheless, they hope that the retrieved information will help Harry Potter and his team in the upcoming match against Slytherin. Harry Potter learned that at the beginning the game he will be at the point (Px,\u2009Py,\u2009Pz) and his super fast Nimbus 2011 broom allows him to move at the constant speed vp in any direction or remain idle. vp is not less than the speed of the snitch vs. Harry Potter, of course, wants to catch the snitch as soon as possible. Or, if catching the snitch while it is moving along the polyline is impossible, he wants to hurry the Weasley brothers with their experiments. Harry Potter catches the snitch at the time when they are at the same point. Help Harry.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u200910000). The following n\u2009+\u20091 lines contain the coordinates xi, yi, zi, separated by single spaces. The coordinates of any two consecutive points do not coincide. The next line contains the velocities vp and vs, the last line contains Px, Py, Pz, separated by single spaces. All the numbers in the input are integers, their absolute value does not exceed 104. The speeds are strictly positive. It is guaranteed that vs\u2009\u2264\u2009vp.","output_specification":"If Harry Potter can catch the snitch while it is moving along the polyline (including the end (xn,\u2009yn,\u2009zn)), print \"YES\" in the first line (without the quotes). Print in the second line t, which is the earliest moment of time, when Harry will be able to catch the snitch. On the third line print three numbers X, Y, Z, the coordinates of the point at which this happens. The absolute or relative error in the answer should not exceed 10\u2009-\u20096. If Harry is not able to catch the snitch during its moving along the described polyline, print \"NO\".","notes":null,"sample_inputs":["4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 25","4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 50","1\n1 2 3\n4 5 6\n20 10\n1 2 3"],"sample_outputs":["YES\n25.5000000000\n10.0000000000 4.5000000000 0.0000000000","NO","YES\n0.0000000000\n1.0000000000 2.0000000000 3.0000000000"],"src_uid":"6e2a8aa58ed8cd308cb482e4c24cbbbb","lang_cluster":"Python","difficulty":2100,"human_solution":"import math,sys\neps = 1e-8\nn = input()\nal = [map(int,raw_input().split()) for i in xrange(n+1)]\nvp,vs = map(int,raw_input().split())\npx,py,pz = map(int,raw_input().split())\nal = [(x-px,y-py,z-pz) for x,y,z in al]\n\nd3=lambda x,y,z:x*x+y*y+z*z\nt0 = 0\nrt,pt = None,0\nts = 0\n \nfor i in range(n):\n c = [y-x for x,y in zip(al[i],al[i+1])]\n ll = d3(*c)\n l = ll**0.5\n ts+=l\n te = ts\/vs\n v = [vs*x for x in c]\n s = [l*x-a*t0 for x,a in zip(al[i],v)]\n a = d3(*v)-vp*vp*ll\n b = 2*sum(x*i for x,i in zip(s,v))\n c = d3(*s)\n d = b*b-4*a*c\n fa = abs(a)t):\n rt,pt=t,[(x+a*t)\/l for x,a in zip(s,v)]\n if fa:\n if abs(b)>eps: tsol(-c\/b)\n elif d>-eps:\n if d= boss_prev:\n\t\tprint('NO')\n\t\tbreak\n\ttick += 1\n","testcases":"[{'input': '2 10 3\\r\\n100 3\\r\\n99 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 100 10\\r\\n100 11\\r\\n90 9\\r\\n', 'output': ['YES\\r\\n19 2\\r\\n0 1\\r\\n10 2\\r\\n']}, {'input': '10 100 5\\r\\n61 3\\r\\n55 2\\r\\n12 6\\r\\n39 5\\r\\n21 10\\r\\n39 7\\r\\n16 1\\r\\n10 1\\r\\n70 5\\r\\n100 7\\r\\n', 'output': ['YES\\r\\n21 6\\r\\n0 10\\r\\n15 9\\r\\n17 1\\r\\n18 2\\r\\n19 6\\r\\n20 5\\r\\n']}, {'input': '20 1000 35\\r\\n10 6\\r\\n66 38\\r\\n81 11\\r\\n18 46\\r\\n80 54\\r\\n76 55\\r\\n100 7\\r\\n96 23\\r\\n24 37\\r\\n4 24\\r\\n4 50\\r\\n71 4\\r\\n83 15\\r\\n7 23\\r\\n100 44\\r\\n99 34\\r\\n100 17\\r\\n100 66\\r\\n23 15\\r\\n90 35\\r\\n', 'output': ['YES\\r\\n7 7\\r\\n0 18\\r\\n1 15\\r\\n2 20\\r\\n3 5\\r\\n4 6\\r\\n5 2\\r\\n6 4\\r\\n']}, {'input': '20 1000 100\\r\\n49 26\\r\\n46 36\\r\\n1 114\\r\\n80 4\\r\\n80 125\\r\\n100 17\\r\\n6 184\\r\\n100 20\\r\\n59 60\\r\\n47 92\\r\\n52 20\\r\\n44 50\\r\\n3 15\\r\\n10 192\\r\\n6 13\\r\\n60 3\\r\\n63 102\\r\\n78 17\\r\\n0 124\\r\\n31 100\\r\\n', 'output': ['NO\\r\\n']}, {'input': '35 999 199\\r\\n95 80\\r\\n79 279\\r\\n14 291\\r\\n100 88\\r\\n64 55\\r\\n100 209\\r\\n85 4\\r\\n14 237\\r\\n75 126\\r\\n41 260\\r\\n81 67\\r\\n99 311\\r\\n71 220\\r\\n98 312\\r\\n53 213\\r\\n55 377\\r\\n78 374\\r\\n79 308\\r\\n34 40\\r\\n92 281\\r\\n53 119\\r\\n96 170\\r\\n90 7\\r\\n87 176\\r\\n27 50\\r\\n78 95\\r\\n31 327\\r\\n56 138\\r\\n91 221\\r\\n7 144\\r\\n100 335\\r\\n29 139\\r\\n61 247\\r\\n38 203\\r\\n100 242\\r\\n', 'output': ['YES\\r\\n3 3\\r\\n0 31\\r\\n1 14\\r\\n2 16\\r\\n']}, {'input': '50 1000 17\\r\\n26 1\\r\\n96 22\\r\\n100 27\\r\\n99 30\\r\\n97 5\\r\\n39 14\\r\\n100 17\\r\\n100 8\\r\\n98 21\\r\\n100 17\\r\\n100 34\\r\\n75 11\\r\\n68 31\\r\\n100 13\\r\\n3 5\\r\\n74 4\\r\\n100 12\\r\\n100 25\\r\\n100 32\\r\\n3 14\\r\\n100 10\\r\\n100 2\\r\\n75 28\\r\\n24 16\\r\\n27 20\\r\\n34 13\\r\\n64 29\\r\\n50 19\\r\\n90 22\\r\\n42 7\\r\\n48 12\\r\\n97 34\\r\\n22 1\\r\\n57 33\\r\\n100 13\\r\\n100 31\\r\\n61 12\\r\\n100 18\\r\\n64 19\\r\\n29 24\\r\\n100 33\\r\\n87 10\\r\\n35 33\\r\\n77 28\\r\\n100 15\\r\\n87 34\\r\\n68 2\\r\\n44 29\\r\\n55 3\\r\\n41 5\\r\\n', 'output': ['YES\\r\\n8 8\\r\\n0 11\\r\\n1 41\\r\\n2 32\\r\\n3 46\\r\\n4 19\\r\\n5 13\\r\\n6 34\\r\\n7 43\\r\\n']}, {'input': '70 1000 1\\r\\n91 2\\r\\n43 1\\r\\n100 1\\r\\n79 2\\r\\n26 1\\r\\n68 2\\r\\n4 2\\r\\n64 1\\r\\n100 1\\r\\n80 2\\r\\n20 2\\r\\n70 1\\r\\n25 1\\r\\n99 1\\r\\n64 1\\r\\n35 2\\r\\n60 1\\r\\n63 2\\r\\n93 1\\r\\n40 2\\r\\n100 1\\r\\n54 1\\r\\n100 1\\r\\n15 2\\r\\n72 1\\r\\n28 1\\r\\n5 1\\r\\n93 1\\r\\n100 2\\r\\n39 2\\r\\n54 2\\r\\n100 1\\r\\n55 1\\r\\n43 1\\r\\n20 1\\r\\n28 2\\r\\n21 1\\r\\n100 2\\r\\n98 1\\r\\n35 1\\r\\n12 2\\r\\n50 2\\r\\n7 2\\r\\n7 2\\r\\n12 2\\r\\n100 2\\r\\n44 1\\r\\n40 2\\r\\n56 2\\r\\n5 1\\r\\n100 1\\r\\n94 2\\r\\n100 2\\r\\n74 1\\r\\n83 2\\r\\n100 2\\r\\n81 2\\r\\n37 2\\r\\n29 1\\r\\n100 2\\r\\n99 1\\r\\n39 2\\r\\n83 2\\r\\n96 2\\r\\n30 2\\r\\n39 1\\r\\n38 1\\r\\n51 1\\r\\n11 1\\r\\n100 2\\r\\n', 'output': ['YES\\r\\n34 34\\r\\n0 29\\r\\n1 38\\r\\n2 46\\r\\n3 53\\r\\n4 56\\r\\n5 60\\r\\n6 70\\r\\n7 64\\r\\n8 52\\r\\n9 3\\r\\n10 1\\r\\n11 9\\r\\n12 14\\r\\n13 19\\r\\n14 55\\r\\n15 4\\r\\n16 10\\r\\n17 57\\r\\n18 63\\r\\n19 6\\r\\n20 8\\r\\n21 18\\r\\n22 12\\r\\n23 31\\r\\n24 42\\r\\n25 49\\r\\n26 20\\r\\n27 16\\r\\n28 30\\r\\n29 36\\r\\n30 11\\r\\n31 24\\r\\n32 41\\r\\n33 7\\r\\n']}, {'input': '4 660 722\\r\\n67 360\\r\\n96 778\\r\\n6 1041\\r\\n62 395\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 328 249\\r\\n62 265\\r\\n32 271\\r\\n72 237\\r\\n28 99\\r\\n22 364\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 351 183\\r\\n16 337\\r\\n19 221\\r\\n81 359\\r\\n87 253\\r\\n5 240\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2 439 283\\r\\n25 510\\r\\n31 547\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4 337 873\\r\\n62 81\\r\\n87 481\\r\\n39 1189\\r\\n45 450\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 940 591\\r\\n92 762\\r\\n59 255\\r\\n15 1061\\r\\n53 1016\\r\\n10 527\\r\\n', 'output': ['NO\\r\\n']}, {'input': '5 851 931\\r\\n88 401\\r\\n48 1196\\r\\n86 1817\\r\\n20 1575\\r\\n30 1474\\r\\n', 'output': ['NO\\r\\n']}, {'input': '29 634 982\\r\\n60 1351\\r\\n54 640\\r\\n1 253\\r\\n72 24\\r\\n40 529\\r\\n52 339\\r\\n73 21\\r\\n34 1284\\r\\n32 1264\\r\\n76 1346\\r\\n92 320\\r\\n11 1441\\r\\n67 1215\\r\\n69 1524\\r\\n77 1672\\r\\n83 412\\r\\n48 241\\r\\n25 894\\r\\n91 1474\\r\\n18 1743\\r\\n98 1944\\r\\n48 788\\r\\n77 860\\r\\n31 629\\r\\n91 1042\\r\\n36 1116\\r\\n41 1162\\r\\n63 129\\r\\n15 1125\\r\\n', 'output': ['NO\\r\\n']}, {'input': '10 1000 8\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n', 'output': ['YES\\r\\n509 10\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 8\\r\\n8 9\\r\\n9 10\\r\\n']}, {'input': '11 2 10\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n', 'output': ['YES\\r\\n12 11\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n6 7\\r\\n7 8\\r\\n8 9\\r\\n9 10\\r\\n10 11\\r\\n']}, {'input': '3 200 10\\r\\n100 3\\r\\n100 8\\r\\n50 1000\\r\\n', 'output': ['YES\\r\\n102 3\\r\\n0 2\\r\\n1 1\\r\\n101 3\\r\\n']}, {'input': '2 100 2\\r\\n100 2\\r\\n100 2\\r\\n', 'output': ['YES\\r\\n51 2\\r\\n0 1\\r\\n1 2\\r\\n']}, {'input': '2 1000 1\\r\\n100 1\\r\\n100 1\\r\\n', 'output': ['YES\\r\\n1001 2\\r\\n0 1\\r\\n1 2\\r\\n']}, {'input': '6 1000 53\\r\\n100 10\\r\\n100 10\\r\\n100 10\\r\\n100 10\\r\\n100 10\\r\\n100 10\\r\\n', 'output': ['YES\\r\\n148 6\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n3 4\\r\\n4 5\\r\\n5 6\\r\\n']}, {'input': '3 100 2\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n', 'output': ['YES\\r\\n102 3\\r\\n0 1\\r\\n1 2\\r\\n2 3\\r\\n']}, {'input': '3 100 3\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 100 4\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '3 100 5\\r\\n100 1\\r\\n100 1\\r\\n100 1\\r\\n', 'output': ['NO\\r\\n']}]","id":174} {"description":"Berland scientists noticed long ago that the world around them depends on Berland population. Due to persistent research in this area the scientists managed to find out that the Berland chronology starts from the moment when the first two people came to that land (it is considered to have happened in the first year). After one Berland year after the start of the chronology the population had already equaled 13 people (the second year). However, tracing the population number during the following years was an ultimately difficult task, still it was found out that if di \u2014 the number of people in Berland in the year of i, then either di\u2009=\u200912di\u2009-\u20092, or di\u2009=\u200913di\u2009-\u20091\u2009-\u200912di\u2009-\u20092. Of course no one knows how many people are living in Berland at the moment, but now we can tell if there could possibly be a year in which the country population equaled A. That's what we ask you to determine. Also, if possible, you have to find out in which years it could be (from the beginning of Berland chronology). Let's suppose that it could be in the years of a1,\u2009a2,\u2009...,\u2009ak. Then you have to define how many residents could be in the country during those years apart from the A variant. Look at the examples for further explanation.","input_specification":"The first line contains integer A (1\u2009\u2264\u2009A\u2009<\u200910300). It is guaranteed that the number doesn't contain leading zeros.","output_specification":"On the first output line print YES, if there could be a year in which the total population of the country equaled A, otherwise print NO. If the answer is YES, then you also have to print number k \u2014 the number of years in which the population could equal A. On the next line you have to output precisely k space-separated numbers \u2014 a1,\u2009a2,\u2009...,\u2009ak. Those numbers have to be output in the increasing order. On the next line you should output number p \u2014 how many variants of the number of people could be in the years of a1,\u2009a2,\u2009...,\u2009ak, apart from the A variant. On each of the next p lines you have to print one number \u2014 the sought number of residents. Those number also have to go in the increasing order. If any number (or both of them) k or p exceeds 1000, then you have to print 1000 instead of it and only the first 1000 possible answers in the increasing order. The numbers should have no leading zeros.","notes":null,"sample_inputs":["2","3","13","1729"],"sample_outputs":["YES\n1\n1\n0","NO","YES\n1\n2\n0","YES\n1\n4\n1\n156"],"src_uid":"0ef5e0621f13107d0c8786766ae2ac56","lang_cluster":"Python","difficulty":2600,"human_solution":"a = int(input())\nans = set()\ndef work(i, z, y):\n z.add(y)\n # print(\">>\", i, y)\n if y == a:\n ans.add(i)\n if len(z) > 1000:\n z.remove(max(z))\n\npos = [set(), set([2])]\nfor i in range(2):\n for x in pos[i]:\n if x == a:\n ans.add(i)\n\ndef dfs(i, last, cur):\n if i > 988:\n return\n while len(pos) - 1 < i:\n pos.append(set())\n if len(pos[i]) == 0 and cur > a:\n return\n if cur in pos[i]:\n return\n work(i, pos[i], cur)\n dfs(i + 1, cur, last * 12)\n dfs(i + 1, cur, cur * 13 - last * 12)\n\ndfs(2, 2, 13)\n\nif len(ans) == 0:\n print(\"NO\")\nelse:\n print(\"YES\")\n count = 0\n print(min(1000, len(ans)))\n z = set()\n for i in sorted(ans):\n if count < 1000:\n print(i)\n count += 1\n for y in pos[i]:\n if y != a:\n z.add(y)\n if len(z) > 1000:\n z.remove(max(z))\n count = 0\n print(min(1000, len(z)))\n for i in sorted(z):\n print(i)\n count += 1\n if count >= 1000:\n break","testcases":"[{'input': '2\\r\\n', 'output': ['YES\\r\\n1\\r\\n1\\r\\n0\\r\\n']}, {'input': '3\\r\\n', 'output': ['NO\\r\\n']}, {'input': '13\\r\\n', 'output': ['YES\\r\\n1\\r\\n2\\r\\n0\\r\\n']}, {'input': '1729\\r\\n', 'output': ['YES\\r\\n1\\r\\n4\\r\\n1\\r\\n156\\r\\n']}, {'input': '1\\r\\n', 'output': ['NO\\r\\n']}, {'input': '156\\r\\n', 'output': ['YES\\r\\n1\\r\\n4\\r\\n1\\r\\n1729\\r\\n']}, {'input': '144\\r\\n', 'output': ['NO\\r\\n']}, {'input': '15407021574586369\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n']}, {'input': '1283918464548876\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n15407021574586369\\r\\n']}, {'input': '106993205379216\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '8916100449984\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '743008391424\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n61917613056\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '61917613056\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n5162766336\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '5162766336\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n465813504\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '465813504\\r\\n', 'output': ['YES\\r\\n1\\r\\n16\\r\\n7\\r\\n5162766336\\r\\n61917613056\\r\\n743008391424\\r\\n8916100449984\\r\\n106993205379216\\r\\n1283918464548876\\r\\n15407021574586369\\r\\n']}, {'input': '1190892770349870530939783612223854919520376583681977765887915460625605936058755310651852367291739265953207545289130222590192089760107219016552443777446454737593270848929686985225627328165141495957916933183554147885929489200931370369335342990301385609877410822418323040587200691179244114277235163137\\r\\n', 'output': ['NO\\r\\n']}, {'input': '595446385174935265469891806111927459760188291840988882943957730312802968029377655325926183645869632976603772644565111295096044880053609508276221888723227368796635424464843492612813664082570747978958466591777073942964744600465685184667671495150692804938705411209161520293600345589622057138617581568\\r\\n', 'output': ['NO\\r\\n']}, {'input': '25\\r\\n', 'output': ['NO\\r\\n']}, {'input': '941796563564014133460267652699405064136604147775680640408635568423120076418612383600961606320075481457728632621229496557902028935524874377670656752361237195740789199168688114539822313589449591752852405348364368488613997844015773837981050319855641810991084718329572826001220219\\r\\n', 'output': ['NO\\r\\n']}, {'input': '79360359146807441660707083821018832188095237636414144034857851003419752010124705615779249215657075053438039921073878645370211154334804568157886814559909\\r\\n', 'output': ['NO\\r\\n']}, {'input': '63730052926382178992698271572\\r\\n', 'output': ['NO\\r\\n']}, {'input': '781127467969689863953686682245136076127159921705034542049372816247984349746396880068864077830521695515007722284098436125466526268962707778595903329840419133974864831578401355678018910046595664462\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6158324958633591462725987806787114657822761584945953440793358408\\r\\n', 'output': ['NO\\r\\n']}, {'input': '46865942276811740149949176718949673344632458696505595472917789224885825949034661409971763949176343056701403524645790892802371117466746709730235969308113002256137529699677021858777002204698794034488631496662175642982367736619451227\\r\\n', 'output': ['NO\\r\\n']}, {'input': '30237645054497458443810364460387991000047179363449854478913094584184671326397148735574822623728870964468880\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2340834982489248497640077401144544875656219324259480464300721974528452789353163588007890141857933775490305682107276886017882071992830194933217950703328428111517059826130590646975303231172522274173055168264136989194405810785131454927884294753122224538370897882934059\\r\\n', 'output': ['NO\\r\\n']}, {'input': '188808426143782131983811729737047667239979348184409855460833141044812532916921011366813880911319644625405122800255947507577498497005580408229\\r\\n', 'output': ['NO\\r\\n']}, {'input': '11\\r\\n', 'output': ['NO\\r\\n']}, {'input': '837952166310387766556098005402621146120844433859027080340550200820\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6658370691480968202384509492140362150472696196949673577340706113760133821635599667476781507918250717914609488172442814676\\r\\n', 'output': ['NO\\r\\n']}, {'input': '496620932866717074931903995027173085744596193421095444317407919730992986418713478580824584919587030125446806223296721174921873955469939680411818878465888018986191990428049489376\\r\\n', 'output': ['NO\\r\\n']}, {'input': '1055050055824280186133547527395898666709023463559337207019374080060005629519967890329878081184599905695126755199503698703340223998620951421943134090897041663457029971964336512111472968057533187306110300592753045593222495258017559167383354672\\r\\n', 'output': ['NO\\r\\n']}, {'input': '833488\\r\\n', 'output': ['NO\\r\\n']}, {'input': '6623739799588591251984406341341227075747347067457011846886851179047097\\r\\n', 'output': ['NO\\r\\n']}, {'input': '491137842784568289872893698937459777201151060689848471272003426250808340375567208957554901863756992593841404624991936090178731\\r\\n', 'output': ['NO\\r\\n']}, {'input': '921020945402270233565256424740666649108666245414796768645533036514715926608741510409618545180420952947917462937925573726593991655435868735899832746218676826629010574075553051352459309199055\\r\\n', 'output': ['NO\\r\\n']}, {'input': '73010581613999159726778758153209240813500342925961695523976131595080552126499402124287397930918281238199343324378719343080627189983992629778313739785259010389762036264197722427990331444297391895841265448905560880286941336214995793596526089977876\\r\\n', 'output': ['NO\\r\\n']}, {'input': '20046142930690780976270827075270\\r\\n', 'output': ['NO\\r\\n']}, {'input': '9685166910821197056344900917707673568669808490600751439157007968027004377622601634787545920946543261243701428886581331490848676434786296227674864970612484770201\\r\\n', 'output': ['NO\\r\\n']}, {'input': '8135498415686025907059626116077260223347794805104214588176486213766836727225732896611278946787711775240855660997946707132990500568944980168321229607627861318462551364491230037357687242571268657488824365976425738641613571689437917277074234256494445914221354904615014917288299991097350709814\\r\\n', 'output': ['NO\\r\\n']}, {'input': '4805043123239964766764344326469867688727869311599746349016084457204677169811854267718990063526979167327981002200329174783850464\\r\\n', 'output': ['NO\\r\\n']}, {'input': '2376595620091080825479292544658464163405755746884100218035485700973409491416884420742631899446144679322008453313773241425622490028383089317622842863337164723765526589656211098933400307364163919083790470365474085981340438888606855706394352678991102\\r\\n', 'output': ['NO\\r\\n']}, {'input': '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n', 'output': ['NO\\r\\n']}, {'input': '145\\r\\n', 'output': ['YES\\r\\n1\\r\\n3\\r\\n1\\r\\n24\\r\\n']}, {'input': '24\\r\\n', 'output': ['YES\\r\\n1\\r\\n3\\r\\n1\\r\\n145\\r\\n']}, {'input': '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\\r\\n', 'output': ['NO\\r\\n']}]","id":175} {"description":"Vasya tries to break in a safe. He knows that a code consists of n numbers, and every number is a 0 or a 1. Vasya has made m attempts to enter the code. After each attempt the system told him in how many position stand the right numbers. It is not said in which positions the wrong numbers stand. Vasya has been so unlucky that he hasn\u2019t entered the code where would be more than 5 correct numbers. Now Vasya is completely bewildered: he thinks there\u2019s a mistake in the system and it is self-contradictory. Help Vasya \u2014 calculate how many possible code variants are left that do not contradict the previous system responses.","input_specification":"The first input line contains two integers n and m (6\u2009\u2264\u2009n\u2009\u2264\u200935,\u20091\u2009\u2264\u2009m\u2009\u2264\u200910) which represent the number of numbers in the code and the number of attempts made by Vasya. Then follow m lines, each containing space-separated si and ci which correspondingly indicate Vasya\u2019s attempt (a line containing n numbers which are 0 or 1) and the system\u2019s response (an integer from 0 to 5 inclusively).","output_specification":"Print the single number which indicates how many possible code variants that do not contradict the m system responses are left.","notes":null,"sample_inputs":["6 2\n000000 2\n010100 4","6 3\n000000 2\n010100 4\n111100 0","6 3\n000000 2\n010100 4\n111100 2"],"sample_outputs":["6","0","1"],"src_uid":"5215112549723fea3f2c1fe0049e0b2e","lang_cluster":"Python","difficulty":2200,"human_solution":"from itertools import combinations\n\ndef calculate(s, dif):\n\tx = int(s, 2)\n\tfor j in combinations(range(len(s)), dif):\n\t\ty = x\n\t\tfor k in j:\n\t\t\ty ^= (2**k)\n\t\tyield y\n\ndef calculate2(s, dif, arr):\n\ty = int(s, 2)\n\tfor x in arr:\n\t if(bin(y ^ x).count('1') == dif):\n\t yield x\n\n\nn, m = map(int, input().split())\nresult = []\n(st, dif) = input().split()\ntotal = calculate(st, int(dif))\nfor i in range(1, m):\n\tst, dif = input().split()\n\ttotal = calculate2(st, int(dif), total)\n\nprint(len(list(total)))\n","testcases":"[{'input': '6 2\\r\\n000000 2\\r\\n010100 4\\r\\n', 'output': ['6\\r\\n']}, {'input': '6 3\\r\\n000000 2\\r\\n010100 4\\r\\n111100 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '6 3\\r\\n000000 2\\r\\n010100 4\\r\\n111100 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 1\\r\\n101011 2\\r\\n', 'output': ['15\\r\\n']}, {'input': '7 2\\r\\n1011111 2\\r\\n1001111 1\\r\\n', 'output': ['6\\r\\n']}, {'input': '6 4\\r\\n000110 2\\r\\n010001 2\\r\\n001111 2\\r\\n001100 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '8 3\\r\\n00111100 5\\r\\n10100111 2\\r\\n10110101 2\\r\\n', 'output': ['6\\r\\n']}, {'input': '35 10\\r\\n10010111001010111001011111000111111 1\\r\\n10100111001010100001111111010111111 5\\r\\n10010111001011110001001111010111110 4\\r\\n10010111001010011011011111010110111 3\\r\\n10010111001010111011011111010111111 1\\r\\n10110011001010111011011111010111111 3\\r\\n10010110001011111001011111010111111 2\\r\\n10000111000010111001111101000111111 5\\r\\n10010111000010011001011111010111111 2\\r\\n10010111001010111001011111000111111 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n11110011011000001101011101111100000 5\\r\\n01000011011001101101011101011101010 5\\r\\n11110011011000001101011101000101011 5\\r\\n11000011011101101101011111010001000 5\\r\\n10100011011001101101001101010101001 4\\r\\n11110011111000100101011101110001000 5\\r\\n01100111011000101101001101010101100 4\\r\\n11110001011000101111011101010101000 3\\r\\n11110010011010101100011101010101000 4\\r\\n10100011011000111101011101111101010 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n11101100001010011101100010101111111 5\\r\\n11101100010011101100001010101011011 5\\r\\n11101100001101111110000011101111010 5\\r\\n11101100101001111100000110111111001 5\\r\\n11101100001011000100001011101111011 5\\r\\n10101000001011111010000010001111011 5\\r\\n11101100001011111100010000111110001 5\\r\\n11101000001111111100000010101001010 5\\r\\n11101001001010101100100010101111011 5\\r\\n11100100001011111100010010001101010 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n10011011100001001101101001100011001 5\\r\\n10011011111001001101001010100011101 3\\r\\n11001011101101001101101010000000101 5\\r\\n10011011101001001101111010100001111 4\\r\\n10011011101001001101111010110011001 4\\r\\n10111001100001001101101010000011101 3\\r\\n10011011101001001101001010000101101 3\\r\\n10110011101001001100101010000011100 4\\r\\n00011110101001001101101011000011101 4\\r\\n10011111101001011101101010000001101 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n10000111101101011000011000011001110 5\\r\\n11010110010101011000111000111001110 5\\r\\n10011111111111011000110000011001110 5\\r\\n10000110110011011000111001001001110 5\\r\\n11100111110111001000111000001001011 5\\r\\n11101111110111001000011010011001110 5\\r\\n11000011110111001001111000110001110 5\\r\\n11010111111111011010111000111000110 5\\r\\n11100110010111011000111000110001110 5\\r\\n11000110110111111000101010011001111 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n01001110011001000001000010001101110 5\\r\\n01001101111011000001001000001000110 5\\r\\n01000101011000000011010000001100110 5\\r\\n00011101001001000011000001011100110 5\\r\\n11011111010001001011000000001100110 5\\r\\n01011100001011000001100000011100110 5\\r\\n00011101011011000100000100001100110 5\\r\\n01011101011000010001100000001100011 5\\r\\n01011001011011010001000000001110100 5\\r\\n01010101010001011001000000001110110 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n00101110001000011000011100001110011 5\\r\\n00111100011110011000011111111110010 5\\r\\n01101010011110111000011110100110010 5\\r\\n01101111010100011010011110101100010 5\\r\\n00101110011100011000010111011110011 5\\r\\n10001110111100011000111111101110010 5\\r\\n01101111011100010000010111101110010 5\\r\\n11101100011100011000010110101100010 5\\r\\n00101100011100011000011100001101010 5\\r\\n00100110011100011000011000111110000 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 1\\r\\n00001111001110101000001101100010010 5\\r\\n', 'output': ['324632\\r\\n']}, {'input': '30 10\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n010000010000001001000000010000 5\\r\\n', 'output': ['142506\\r\\n']}, {'input': '35 2\\r\\n00101101100111101110111010001101101 3\\r\\n00111111100101010110111010001101101 3\\r\\n', 'output': ['20\\r\\n']}, {'input': '35 1\\r\\n11000110100110101001100101001010110 2\\r\\n', 'output': ['595\\r\\n']}, {'input': '35 2\\r\\n00111111100000111101000110100111101 1\\r\\n00111111000000111101000010100111101 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '35 6\\r\\n01100100110000001001100110001100011 5\\r\\n10000100110000011001110010001100011 5\\r\\n00101110100000010000100010001110011 4\\r\\n00110010101000011001100000001110011 5\\r\\n00100101110000011001101110001110011 4\\r\\n00110110110000011001101000000100011 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '34 10\\r\\n0010101000011110000100111111010110 5\\r\\n0110011001011110001101110111000110 5\\r\\n0111001000011100000100111111110110 4\\r\\n0011011000001110100000110111010110 4\\r\\n0101011000011110000100010111010111 3\\r\\n0111011000011111010100111111010110 3\\r\\n0110010000011110000100110111010010 3\\r\\n0111011001111110000100110111010111 3\\r\\n1111111000011010000100110111010100 4\\r\\n1111001000011110000100110111001111 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '6 10\\r\\n110000 5\\r\\n010011 4\\r\\n110011 5\\r\\n110010 4\\r\\n000001 4\\r\\n010001 5\\r\\n110101 5\\r\\n110011 5\\r\\n110010 4\\r\\n011001 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n11001101010000101110001101101110111 4\\r\\n11010101010000101011001001110100110 5\\r\\n11000100010000101011001100100100110 4\\r\\n11000001000100101011001101101100110 4\\r\\n01000101000000101010011101101110010 5\\r\\n00000101010010001011001101101100110 5\\r\\n01000101010100101010001101100010110 5\\r\\n11000100010000010010001101101100110 4\\r\\n10000101010000100010000101101100111 4\\r\\n11001100010000100010011101101100110 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n01110001000111100010110001110110100 5\\r\\n01110001000000000010100001110100010 3\\r\\n01110000100100000010100001111110010 4\\r\\n11110001011110000010100001110111010 4\\r\\n01110101000111000010100001110110110 3\\r\\n10110001000100010010000001110110010 5\\r\\n01110011000111000011100001110110010 3\\r\\n00110001000110000011100001111110010 3\\r\\n01110011000010000110000001110111010 5\\r\\n11110001000110100010101001110110010 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n10011010100110011101110001101011011 2\\r\\n10111010100111011011110000101011011 3\\r\\n10011010101111001001110000111111011 5\\r\\n10011010100111011100110000100011011 2\\r\\n10011010100111001101010000101010011 3\\r\\n10010010101001011101110000101011111 5\\r\\n10011010100111010101110000100011011 2\\r\\n00011010100111011100110001101011111 4\\r\\n10011010100111011101110000111001011 2\\r\\n10010000000110011101110000101011011 4\\r\\n', 'output': ['1\\r\\n']}, {'input': '35 10\\r\\n10101100110000010101111100110001110 4\\r\\n10100110000110000101011100110001110 4\\r\\n10100110111110000101010100010001110 5\\r\\n11100100010000000101010100110000110 5\\r\\n10100010110000100101011100110001110 2\\r\\n10000110100000000100011100110001100 4\\r\\n10000110110000000001011100110101110 3\\r\\n10100010111000000101011101110000110 4\\r\\n10100100110000000111001100110001110 3\\r\\n10100110100000000101011101110001110 2\\r\\n', 'output': ['1\\r\\n']}]","id":176} {"description":"In the town of Aalam-Aara (meaning the Light of the Earth), previously there was no crime, no criminals but as the time progressed, sins started creeping into the hearts of once righteous people. Seeking solution to the problem, some of the elders found that as long as the corrupted part of population was kept away from the uncorrupted part, the crimes could be stopped. So, they are trying to set up a compound where they can keep the corrupted people. To ensure that the criminals don't escape the compound, a watchtower needs to be set up, so that they can be watched.Since the people of Aalam-Aara aren't very rich, they met up with a merchant from some rich town who agreed to sell them a land-plot which has already a straight line fence AB along which a few points are set up where they can put up a watchtower. Your task is to help them find out the number of points on that fence where the tower can be put up, so that all the criminals can be watched from there. Only one watchtower can be set up. A criminal is watchable from the watchtower if the line of visibility from the watchtower to him doesn't cross the plot-edges at any point between him and the tower i.e. as shown in figure 1 below, points X, Y, C and A are visible from point B but the points E and D are not. Figure 1 Figure 2 Assume that the land plot is in the shape of a polygon and coordinate axes have been setup such that the fence AB is parallel to x-axis and the points where the watchtower can be set up are the integer points on the line. For example, in given figure 2, watchtower can be setup on any of five integer points on AB i.e. (4,\u20098), (5,\u20098), (6,\u20098), (7,\u20098) or (8,\u20098). You can assume that no three consecutive points are collinear and all the corner points other than A and B, lie towards same side of fence AB. The given polygon doesn't contain self-intersections.","input_specification":"The first line of the test case will consist of the number of vertices n (3\u2009\u2264\u2009n\u2009\u2264\u20091000). Next n lines will contain the coordinates of the vertices in the clockwise order of the polygon. On the i-th line are integers xi and yi (0\u2009\u2264\u2009xi,\u2009yi\u2009\u2264\u2009106) separated by a space. The endpoints of the fence AB are the first two points, (x1,\u2009y1) and (x2,\u2009y2).","output_specification":"Output consists of a single line containing the number of points where the watchtower can be set up.","notes":"NoteFigure 2 shows the first test case. All the points in the figure are watchable from any point on fence AB. Since, AB has 5 integer coordinates, so answer is 5.For case two, fence CD and DE are not completely visible, thus answer is 0.","sample_inputs":["5\n4 8\n8 8\n9 4\n4 0\n0 4","5\n4 8\n5 8\n5 4\n7 4\n2 2"],"sample_outputs":["5","0"],"src_uid":"1503f0379bf8d7f25c191ddea9278842","lang_cluster":"Python","difficulty":2500,"human_solution":"from math import floor,ceil\nn = input()\nx,y = zip(*[map(int,raw_input().split()) for _ in xrange(n)])\nnr,mr=min(x[:2]),max(x[:2])\nfor j in xrange(3,n):\n i = j-1\n dx = x[j]-x[i]\n dy = y[j]-y[i]\n t = 1.*(y[0]-y[i])*dx;\n r = t\/dy+x[i] if dy else 1e9\n if t-dy*(mr-x[i])>0 and r0 and r>nr: nr=r;\nmr = floor(mr)-ceil(nr)\nprint \"%.0f\"%(0. if mr<-1e-14 else mr+1.1)\n\n","testcases":"[{'input': '5\\r\\n4 8\\r\\n8 8\\r\\n9 4\\r\\n4 0\\r\\n0 4\\r\\n', 'output': ['5\\r\\n']}, {'input': '5\\r\\n4 8\\r\\n5 8\\r\\n5 4\\r\\n7 4\\r\\n2 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n0 4\\r\\n5 4\\r\\n2 0\\r\\n', 'output': ['6\\r\\n']}, {'input': '4\\r\\n0 4\\r\\n5 4\\r\\n5 0\\r\\n0 0\\r\\n', 'output': ['6\\r\\n']}, {'input': '4\\r\\n100 200\\r\\n800 200\\r\\n500 100\\r\\n100 0\\r\\n', 'output': ['701\\r\\n']}, {'input': '5\\r\\n0 4\\r\\n5 4\\r\\n2 2\\r\\n4 0\\r\\n0 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n2 5\\r\\n5 5\\r\\n4 4\\r\\n5 3\\r\\n0 0\\r\\n', 'output': ['2\\r\\n']}, {'input': '6\\r\\n1 9\\r\\n10 9\\r\\n11 7\\r\\n9 5\\r\\n5 7\\r\\n1 0\\r\\n', 'output': ['6\\r\\n']}, {'input': '6\\r\\n1 9\\r\\n10 9\\r\\n5 7\\r\\n11 7\\r\\n9 5\\r\\n1 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n10 150\\r\\n90 150\\r\\n10 15\\r\\n', 'output': ['81\\r\\n']}, {'input': '5\\r\\n0 100\\r\\n50 100\\r\\n50 99\\r\\n149 0\\r\\n0 0\\r\\n', 'output': ['50\\r\\n']}, {'input': '10\\r\\n1000 0\\r\\n100 0\\r\\n0 25\\r\\n100 50\\r\\n100 51\\r\\n99 102\\r\\n1001 102\\r\\n1000 51\\r\\n1000 50\\r\\n1100 25\\r\\n', 'output': ['899\\r\\n']}, {'input': '6\\r\\n1 1000000\\r\\n999999 1000000\\r\\n519023 50000\\r\\n520013 500\\r\\n300033 50\\r\\n400023 500000\\r\\n', 'output': ['1\\r\\n']}, {'input': '8\\r\\n100 100\\r\\n10 100\\r\\n0 200\\r\\n5 400\\r\\n20 800\\r\\n16 801\\r\\n50 900\\r\\n110 300\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n588523 0\\r\\n411477 0\\r\\n400000 86602\\r\\n', 'output': ['177047\\r\\n']}, {'input': '15\\r\\n507852 0\\r\\n492148 0\\r\\n489545 9858\\r\\n489631 11995\\r\\n490865 14012\\r\\n491570 15795\\r\\n492996 17376\\r\\n495001 18605\\r\\n496671 19452\\r\\n498570 19850\\r\\n500373 19859\\r\\n502484 19363\\r\\n505000 18605\\r\\n506393 17344\\r\\n507857 15808\\r\\n', 'output': ['15705\\r\\n']}, {'input': '4\\r\\n889308 0\\r\\n110692 0\\r\\n0 461939\\r\\n146447 815492\\r\\n', 'output': ['778617\\r\\n']}, {'input': '5\\r\\n785915 0\\r\\n214085 0\\r\\n40939 436592\\r\\n128612 706421\\r\\n358143 873184\\r\\n', 'output': ['571831\\r\\n']}, {'input': '5\\r\\n999990 0\\r\\n0 0\\r\\n0 1000000\\r\\n1000000 1000000\\r\\n500000 50000\\r\\n', 'output': ['473685\\r\\n']}, {'input': '8\\r\\n3 0\\r\\n0 0\\r\\n0 1\\r\\n1 1\\r\\n1 2\\r\\n2 2\\r\\n2 1\\r\\n3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '6\\r\\n1 4\\r\\n3 4\\r\\n2 2\\r\\n1 1\\r\\n2 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '3\\r\\n999998 999999\\r\\n1000000 999999\\r\\n0 0\\r\\n', 'output': ['3\\r\\n']}, {'input': '4\\r\\n999998 999999\\r\\n1000000 999999\\r\\n1 1\\r\\n0 0\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n500944 0\\r\\n499056 0\\r\\n498479 979\\r\\n498437 1288\\r\\n499191 1574\\r\\n499413 1796\\r\\n499300 1937\\r\\n500000 1987\\r\\n499995 1934\\r\\n500587 1796\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 4\\r\\n3 4\\r\\n2 2\\r\\n2 0\\r\\n0 0\\r\\n', 'output': ['3\\r\\n']}, {'input': '6\\r\\n4 0\\r\\n0 0\\r\\n2 2\\r\\n3 4\\r\\n2 5\\r\\n4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n0 5\\r\\n3 5\\r\\n2 3\\r\\n2 2\\r\\n1 2\\r\\n2 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n10 0\\r\\n0 0\\r\\n2 2\\r\\n1 3\\r\\n1 6\\r\\n', 'output': ['7\\r\\n']}, {'input': '8\\r\\n0 6\\r\\n5 6\\r\\n5 4\\r\\n3 4\\r\\n3 2\\r\\n5 2\\r\\n5 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '7\\r\\n0 6\\r\\n5 6\\r\\n5 4\\r\\n3 4\\r\\n3 2\\r\\n5 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n1000000 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n999999 0\\r\\n0 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n999998 0\\r\\n0 0\\r\\n', 'output': ['1\\r\\n']}, {'input': '6\\r\\n0 999999\\r\\n1 999999\\r\\n1 999998\\r\\n2 999998\\r\\n1000000 0\\r\\n0 0\\r\\n', 'output': ['0\\r\\n']}, {'input': '5\\r\\n999999 0\\r\\n0 0\\r\\n999999 999998\\r\\n1 1\\r\\n1000000 1000000\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n5 6\\r\\n7 6\\r\\n8 2\\r\\n6 2\\r\\n7 3\\r\\n6 4\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n7 8\\r\\n5 8\\r\\n4 12\\r\\n6 12\\r\\n5 11\\r\\n6 10\\r\\n', 'output': ['0\\r\\n']}, {'input': '6\\r\\n5 6\\r\\n12 6\\r\\n8 2\\r\\n6 2\\r\\n7 3\\r\\n6 4\\r\\n', 'output': ['3\\r\\n']}, {'input': '6\\r\\n10 12\\r\\n24 12\\r\\n16 4\\r\\n12 4\\r\\n14 6\\r\\n12 8\\r\\n', 'output': ['5\\r\\n']}]","id":177} {"description":"Every year a race takes place on the motorway between cities A and B. This year Vanya decided to take part in the race and drive his own car that has been around and bears its own noble name \u2014 The Huff-puffer.So, Vasya leaves city A on the Huff-puffer, besides, at the very beginning he fills the petrol tank with \u03b1 liters of petrol (\u03b1\u2009\u2265\u200910 is Vanya's favorite number, it is not necessarily integer). Petrol stations are located on the motorway at an interval of 100 kilometers, i.e. the first station is located 100 kilometers away from the city A, the second one is 200 kilometers away from the city A, the third one is 300 kilometers away from the city A and so on. The Huff-puffer spends 10 liters of petrol every 100 kilometers. Vanya checks the petrol tank every time he passes by a petrol station. If the petrol left in the tank is not enough to get to the next station, Vanya fills the tank with \u03b1 liters of petrol. Otherwise, he doesn't stop at the station and drives on. For example, if \u03b1\u2009=\u200943.21, then the car will be fuelled up for the first time at the station number 4, when there'll be 3.21 petrol liters left. After the fuelling up the car will have 46.42 liters. Then Vanya stops at the station number 8 and ends up with 6.42\u2009+\u200943.21\u2009=\u200949.63 liters. The next stop is at the station number 12, 9.63\u2009+\u200943.21\u2009=\u200952.84. The next stop is at the station number 17 and so on. You won't believe this but the Huff-puffer has been leading in the race! Perhaps it is due to unexpected snow. Perhaps it is due to video cameras that have been installed along the motorway which register speed limit breaking. Perhaps it is due to the fact that Vanya threatened to junk the Huff-puffer unless the car wins. Whatever the reason is, the Huff-puffer is leading, and jealous people together with other contestants wrack their brains trying to think of a way to stop that outrage.One way to do this is to mine the next petrol station where Vanya will stop. Your task is to calculate at which station this will happen and warn Vanya. You don't know the \u03b1 number, however, you are given the succession of the numbers of the stations where Vanya has stopped. Find the number of the station where the next stop will be.","input_specification":"The first line contains an integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000) which represents the number of petrol stations where Vanya has stopped. The next line has n space-separated integers which represent the numbers of the stations. The numbers are positive and do not exceed 106, they are given in the increasing order. No two numbers in the succession match. It is guaranteed that there exists at least one number \u03b1\u2009\u2265\u200910, to which such a succession of stops corresponds.","output_specification":"Print in the first line \"unique\" (without quotes) if the answer can be determined uniquely. In the second line print the number of the station where the next stop will take place. If the answer is not unique, print in the first line \"not unique\".","notes":"NoteIn the second example the answer is not unique. For example, if \u03b1\u2009=\u200910, we'll have such a sequence as 1, 2, 3, and if \u03b1\u2009=\u200914, the sequence will be 1, 2, 4.","sample_inputs":["3\n1 2 4","2\n1 2"],"sample_outputs":["unique\n5","not unique"],"src_uid":"bfbd7a73e65d240ee7e8c83cc68ca0a1","lang_cluster":"Python","difficulty":1800,"human_solution":"I = lambda: map(int, raw_input().split())\n\nn = input()\nS = [None]*n\nS = I()\n#print S\ncounter = 1\ndecr = 0\nalpha = 0.0\nlower = 0.0\n\nfor i in xrange(n):\n if(i == 0):\n alpha = 10*S[0]+10\n decr = 10*S[0]\n counter += 1\n else:\n decr = 10*(S[i]-S[i-1]) + decr\n alpha = min(alpha,(decr + 10 )\/float (counter))\n #print \" alpha = \" , alpha\n if S[i]-1 != S[i-1]:\n lower = max(lower, ( decr )\/float (counter))\n #print \"lower = \", lower\n counter += 1\n\nalpha = alpha - 0.0000000001\nif lower == 0.0 : lower = 10.0\n\n#print \" alpha = \" , alpha\n\nfuel = counter*alpha - decr\nleast = counter*lower - decr\n#print fuel , least\n\nif int(fuel)\/10 == int(least)\/10 :\n print \"unique\"\n print S[n-1]+ int(fuel)\/10\nelse:\n print \"not unique\"\n \n","testcases":"[{'input': '3\\r\\n1 2 4\\r\\n', 'output': ['unique\\r\\n5\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['not unique\\r\\n']}, {'input': '1\\r\\n5\\r\\n', 'output': ['not unique\\r\\n']}, {'input': '3\\r\\n1 3 4\\r\\n', 'output': ['unique\\r\\n6\\r\\n']}, {'input': '5\\r\\n1 2 3 5 6\\r\\n', 'output': ['unique\\r\\n7\\r\\n']}, {'input': '6\\r\\n1 2 3 5 6 7\\r\\n', 'output': ['not unique\\r\\n']}, {'input': '10\\r\\n1 2 4 5 7 8 9 11 12 14\\r\\n', 'output': ['unique\\r\\n15\\r\\n']}, {'input': '10\\r\\n1 3 5 6 8 10 12 13 15 17\\r\\n', 'output': ['not unique\\r\\n']}, {'input': '9\\r\\n2 5 7 10 12 15 17 20 22\\r\\n', 'output': ['unique\\r\\n25\\r\\n']}, {'input': '10\\r\\n7 14 21 28 35 42 49 56 63 70\\r\\n', 'output': ['not unique\\r\\n']}, {'input': '15\\r\\n5 11 16 22 28 33 39 45 50 56 62 67 73 79 84\\r\\n', 'output': ['unique\\r\\n90\\r\\n']}, {'input': '17\\r\\n5 11 16 22 28 33 39 45 50 56 62 67 73 79 84 90 96\\r\\n', 'output': ['unique\\r\\n101\\r\\n']}, {'input': '15\\r\\n1 3 4 6 8 9 11 12 14 16 17 19 21 22 24\\r\\n', 'output': ['unique\\r\\n25\\r\\n']}, {'input': '16\\r\\n1 3 4 6 8 9 11 12 14 16 17 19 21 22 24 25\\r\\n', 'output': ['unique\\r\\n27\\r\\n']}, {'input': '17\\r\\n1 3 4 6 8 9 11 12 14 16 17 19 21 22 24 25 27\\r\\n', 'output': ['unique\\r\\n29\\r\\n']}, {'input': '18\\r\\n1 3 4 6 8 9 11 12 14 16 17 19 21 22 24 25 27 29\\r\\n', 'output': ['unique\\r\\n30\\r\\n']}, {'input': '19\\r\\n1 3 4 6 8 9 11 12 14 16 17 19 21 22 24 25 27 29 30\\r\\n', 'output': ['unique\\r\\n32\\r\\n']}, {'input': '20\\r\\n1 3 4 6 8 9 11 12 14 16 17 19 21 22 24 25 27 29 30 32\\r\\n', 'output': ['not unique\\r\\n']}, {'input': '18\\r\\n49999 99998 149998 199997 249996 299996 349995 399994 449994 499993 549992 599992 649991 699990 749990 799989 849988 899988\\r\\n', 'output': ['unique\\r\\n949987\\r\\n']}, {'input': '20\\r\\n49999 99998 149998 199997 249996 299996 349995 399994 449994 499993 549992 599992 649991 699990 749990 799989 849988 899988 949987 999986\\r\\n', 'output': ['unique\\r\\n1049986\\r\\n']}, {'input': '33\\r\\n9 19 29 39 49 59 69 79 89 99 109 119 129 139 149 159 168 178 188 198 208 218 228 238 248 258 268 278 288 298 308 318 327\\r\\n', 'output': ['unique\\r\\n337\\r\\n']}, {'input': '46\\r\\n40 81 122 162 203 244 284 325 366 406 447 488 528 569 610 650 691 732 772 813 854 894 935 976 1016 1057 1098 1138 1179 1220 1260 1301 1342 1382 1423 1464 1504 1545 1586 1626 1667 1708 1748 1789 1830 1870\\r\\n', 'output': ['unique\\r\\n1911\\r\\n']}, {'input': '50\\r\\n19876 39753 59629 79506 99382 119259 139135 159012 178889 198765 218642 238518 258395 278271 298148 318025 337901 357778 377654 397531 417407 437284 457160 477037 496914 516790 536667 556543 576420 596296 616173 636050 655926 675803 695679 715556 735432 755309 775186 795062 814939 834815 854692 874568 894445 914321 934198 954075 973951 993828\\r\\n', 'output': ['unique\\r\\n1013704\\r\\n']}, {'input': '50\\r\\n564 1129 1693 2258 2822 3387 3951 4516 5080 5645 6210 6774 7339 7903 8468 9032 9597 10161 10726 11290 11855 12420 12984 13549 14113 14678 15242 15807 16371 16936 17500 18065 18630 19194 19759 20323 20888 21452 22017 22581 23146 23710 24275 24840 25404 25969 26533 27098 27662 28227\\r\\n', 'output': ['unique\\r\\n28791\\r\\n']}, {'input': '76\\r\\n342 684 1027 1369 1711 2054 2396 2738 3081 3423 3765 4108 4450 4792 5135 5477 5819 6162 6504 6846 7189 7531 7873 8216 8558 8900 9243 9585 9927 10270 10612 10954 11297 11639 11981 12324 12666 13009 13351 13693 14036 14378 14720 15063 15405 15747 16090 16432 16774 17117 17459 17801 18144 18486 18828 19171 19513 19855 20198 20540 20882 21225 21567 21909 22252 22594 22936 23279 23621 23963 24306 24648 24991 25333 25675 26018\\r\\n', 'output': ['unique\\r\\n26360\\r\\n']}, {'input': '100\\r\\n1 3 4 6 8 9 11 12 14 16 17 19 21 22 24 25 27 29 30 32 33 35 37 38 40 42 43 45 46 48 50 51 53 55 56 58 59 61 63 64 66 67 69 71 72 74 76 77 79 80 82 84 85 87 88 90 92 93 95 97 98 100 101 103 105 106 108 110 111 113 114 116 118 119 121 122 124 126 127 129 131 132 134 135 137 139 140 142 144 145 147 148 150 152 153 155 156 158 160 161\\r\\n', 'output': ['unique\\r\\n163\\r\\n']}, {'input': '101\\r\\n3 7 10 14 18 21 25 28 32 36 39 43 46 50 54 57 61 64 68 72 75 79 82 86 90 93 97 100 104 108 111 115 118 122 126 129 133 137 140 144 147 151 155 158 162 165 169 173 176 180 183 187 191 194 198 201 205 209 212 216 219 223 227 230 234 237 241 245 248 252 255 259 263 266 270 274 277 281 284 288 292 295 299 302 306 310 313 317 320 324 328 331 335 338 342 346 349 353 356 360 364\\r\\n', 'output': ['unique\\r\\n367\\r\\n']}]","id":178} {"description":"You already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should learn to complete the path fastest.The track's map is represented by a rectangle n\u2009\u00d7\u2009m in size divided into squares. Each square is marked with a lowercase Latin letter (which means the type of the plot), with the exception of the starting square (it is marked with a capital Latin letters S) and the terminating square (it is marked with a capital Latin letter T). The time of movement from one square to another is equal to 1 minute. The time of movement within the cell can be neglected. We can move from the cell only to side-adjacent ones, but it is forbidden to go beyond the map edges. Also the following restriction is imposed on the path: it is not allowed to visit more than k different types of squares (squares of one type can be visited an infinite number of times). Squares marked with S and T have no type, so they are not counted. But S must be visited exactly once \u2014 at the very beginning, and T must be visited exactly once \u2014 at the very end.Your task is to find the path from the square S to the square T that takes minimum time. Among all shortest paths you should choose the lexicographically minimal one. When comparing paths you should lexicographically represent them as a sequence of characters, that is, of plot types.","input_specification":"The first input line contains three integers n, m and k (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u200950,\u2009n\u00b7m\u2009\u2265\u20092,\u20091\u2009\u2264\u2009k\u2009\u2264\u20094). Then n lines contain the map. Each line has the length of exactly m characters and consists of lowercase Latin letters and characters S and T. It is guaranteed that the map contains exactly one character S and exactly one character T. Pretest 12 is one of the maximal tests for this problem.","output_specification":"If there is a path that satisfies the condition, print it as a sequence of letters \u2014 the plot types. Otherwise, print \"-1\" (without quotes). You shouldn't print the character S in the beginning and T in the end. Note that this sequence may be empty. This case is present in pretests. You can just print nothing or print one \"End of line\"-character. Both will be accepted.","notes":null,"sample_inputs":["5 3 2\nSba\nccc\naac\nccc\nabT","3 4 1\nSxyy\nyxxx\nyyyT","1 3 3\nTyS","1 4 1\nSxyT"],"sample_outputs":["bcccc","xxxx","y","-1"],"src_uid":"1d73b315694f2ebbf796654193372730","lang_cluster":"Python","difficulty":2400,"human_solution":"import sys\nfrom array import array # noqa: F401\nfrom itertools import combinations\nfrom collections import deque\n\n\ndef input():\n return sys.stdin.buffer.readline().decode('utf-8')\n\n\nn, m, k = map(int, input().split())\nchars = (\n ['}' * (m + 2)]\n + ['}' + ''.join('{' if c == 'S' else '|' if c == 'T' else c for c in input().rstrip()) + '}' for _ in range(n)]\n + ['}' * (m + 2)]\n)\ncbit = [[1 << (ord(c) - 97) for c in chars[i]] for i in range(n + 2)]\n\nsi, sj, ti, tj = 0, 0, 0, 0\nfor i in range(1, n + 1):\n for j in range(1, m + 1):\n if chars[i][j] == '{':\n si, sj = i, j\n cbit[i][j] = 0\n if chars[i][j] == '|':\n ti, tj = i, j\n\n\nans = inf = '*' * (n * m)\n\nfor comb in combinations([1 << i for i in range(26)], r=k):\n enabled = sum(comb)\n\n dp = [[inf] * (m + 2) for _ in range(n + 2)]\n dp[ti][tj] = ''\n dq = deque([(ti, tj, '')])\n while dq:\n i, j, s = dq.popleft()\n if dp[i][j] < s:\n continue\n for di, dj in ((i + 1, j), (i - 1, j), (i, j + 1), (i, j - 1)):\n if (cbit[di][dj] & enabled) != cbit[di][dj]:\n continue\n pre = chars[di][dj] if cbit[di][dj] else ''\n l = 1 if cbit[di][dj] else 0\n if (len(dp[di][dj]) > len(s) + l or len(dp[di][dj]) == len(s) + l and dp[di][dj] > pre + s):\n dp[di][dj] = pre + s\n if l:\n dq.append((di, dj, pre + s))\n\n if len(ans) > len(dp[si][sj]) or len(ans) == len(dp[si][sj]) and ans > dp[si][sj]:\n ans = dp[si][sj]\n\nprint(ans if ans != inf else -1)\n","testcases":"[{'input': '5 3 2\\r\\nSba\\r\\nccc\\r\\naac\\r\\nccc\\r\\nabT\\r\\n', 'output': ['bcccc\\r\\n']}, {'input': '3 4 1\\r\\nSxyy\\r\\nyxxx\\r\\nyyyT\\r\\n', 'output': ['xxxx\\r\\n']}, {'input': '1 3 3\\r\\nTyS\\r\\n', 'output': ['y\\r\\n']}, {'input': '1 4 1\\r\\nSxyT\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 3 3\\r\\nSaT\\r\\n', 'output': ['a\\r\\n']}, {'input': '3 4 1\\r\\nSbbT\\r\\naaaa\\r\\nabba\\r\\n', 'output': ['bb\\r\\n']}, {'input': '3 5 2\\r\\nSbcaT\\r\\nacbab\\r\\nacccb\\r\\n', 'output': ['aacccaa\\r\\n']}, {'input': '3 4 1\\r\\nSbbb\\r\\naaaT\\r\\nabbc\\r\\n', 'output': ['aaa\\r\\n']}, {'input': '3 4 2\\r\\nSbbb\\r\\naabT\\r\\nabbc\\r\\n', 'output': ['aab\\r\\n']}, {'input': '1 2 1\\r\\nST\\r\\n', 'output': ['\\r\\n']}, {'input': '4 5 3\\r\\nabaaa\\r\\nbabaT\\r\\nSabba\\r\\naaaaa\\r\\n', 'output': ['aaba\\r\\n']}, {'input': '6 6 3\\r\\npkhipk\\r\\nmlfmak\\r\\naqmbae\\r\\ndlbfSj\\r\\ndpbjcr\\r\\naTbqbm\\r\\n', 'output': ['cbqb\\r\\n']}, {'input': '1 20 3\\r\\nacbccbbddbffScTadffd\\r\\n', 'output': ['c\\r\\n']}, {'input': '1 30 2\\r\\nbmjcfldkloleiqqiTnmdjpaSckkijf\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 40 1\\r\\nfaSfgfTcfadcdfagfbccbffbeaaebagbfcfcgdfd\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 50 3\\r\\nSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaTaaaaaaaaaaa\\r\\n', 'output': ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\r\\n']}, {'input': '5 10 4\\r\\naaaaaaaaaa\\r\\naaaaaTaaaa\\r\\naaaaaaaSaa\\r\\naaaaaaaaaa\\r\\naaaaaaaaaa\\r\\n', 'output': ['aa\\r\\n']}, {'input': '5 3 4\\r\\naaT\\r\\nacc\\r\\nbbb\\r\\nbbc\\r\\ncSb\\r\\n', 'output': ['bbbc\\r\\n']}, {'input': '5 5 1\\r\\ncaTbc\\r\\ndccac\\r\\ndacda\\r\\naacaS\\r\\ncdcab\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10 8 2\\r\\nbdcdcbfa\\r\\ndecffcce\\r\\ndTffdacb\\r\\neeedcdbb\\r\\nfdbbbcba\\r\\nddabfcda\\r\\nabdbSeed\\r\\nbdcdcffa\\r\\ncadbaffa\\r\\nfcccddad\\r\\n', 'output': ['bbbbee\\r\\n']}, {'input': '20 10 3\\r\\nebebccacdb\\r\\neeebccddeT\\r\\neadebecaac\\r\\nadeeeaccbc\\r\\nbaccccdaed\\r\\ndeabceabba\\r\\ndadbecbaaa\\r\\neacbbcedcb\\r\\naeeScdbbab\\r\\nbabaecaead\\r\\nbacdbebeae\\r\\naacbadbeec\\r\\nacddceecca\\r\\nacaeaebaba\\r\\ncdddeaaeae\\r\\neabddadade\\r\\nddddaeaeed\\r\\nbccbaacadd\\r\\ndccccbabdc\\r\\necdaebeccc\\r\\n', 'output': ['bbbcccaccaac\\r\\n']}, {'input': '15 10 4\\r\\nsejwprqjku\\r\\npnjsiopxft\\r\\nrsplgvwixq\\r\\nendglkchxl\\r\\nftihbbexgh\\r\\nsxtxbbavge\\r\\njcdkusfnmr\\r\\nskgsqvflia\\r\\nkcxmcxjpae\\r\\namaiwcfile\\r\\nnjgjSunmwd\\r\\nldxvahgreu\\r\\necmrajbjuT\\r\\nnaioqigols\\r\\npbwrmxkltj\\r\\n', 'output': ['aajbju\\r\\n']}, {'input': '15 3 4\\r\\nllv\\r\\nttT\\r\\nhbo\\r\\nogc\\r\\nkfe\\r\\ngli\\r\\nfbx\\r\\nkfp\\r\\nspm\\r\\ncxc\\r\\nndw\\r\\nSoa\\r\\npfh\\r\\nedr\\r\\nxmv\\r\\n', 'output': ['-1\\r\\n']}, {'input': '15 15 3\\r\\ncbbdccabdcbacbd\\r\\nbcabdcacadacdbc\\r\\ncbcddbbcdbddcad\\r\\nddcabdbbdcabbdc\\r\\naabadcccTcabdbb\\r\\ncbacaaacaabdbbd\\r\\ndbdcbSdabaadbdb\\r\\ndbbaddcdddaadbb\\r\\nbbddcdcbaccbbaa\\r\\nadadadbdbbddccc\\r\\ncddbbdaddcbbdcc\\r\\nbbaadcdbbcaacca\\r\\nadbdcdbbcbddbcd\\r\\ncdadbcccddcdbda\\r\\ncbcdaabdcabccbc\\r\\n', 'output': ['aaca\\r\\n']}, {'input': '20 20 2\\r\\nddadfcdeTaeccbedeaec\\r\\nacafdfdeaffdeabdcefe\\r\\nabbcbefcdbbbcdebafef\\r\\nfdafdcccbcdeeaedeffc\\r\\ndfdaabdefdafabaabcef\\r\\nfebdcabacaaaabfacbbe\\r\\nabfcaacadfdbfdbaaefd\\r\\ndacceeccddccaccdbbce\\r\\ncacebecabedbddfbfdad\\r\\ndacbfcabbebfddcedffd\\r\\ncfcdfacfadcfbcebebaa\\r\\nddfbebafaccbebeefbac\\r\\nebfaebacbbebdfcbcbea\\r\\ndfbaebcfccacfeaccaad\\r\\nedeedeceebcbfdbcdbbe\\r\\nafaacccfbdecebfdabed\\r\\nddbdcedacedadeccaeec\\r\\necbSeacbdcccbcedafef\\r\\ncfdbeeffbeeafccfdddb\\r\\ncefdbdfbabccfdaaadbf\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10 10 2\\r\\nbaaaaaaaaa\\r\\nbffacffffa\\r\\nbggaccggga\\r\\nbbbSccchha\\r\\nbdddddccia\\r\\nbjddccccca\\r\\nbkkdddTaaa\\r\\nblllddblla\\r\\nbmmmmdbmma\\r\\nbbbbbbbbbb\\r\\n', 'output': ['ccccc\\r\\n']}, {'input': '10 20 3\\r\\nbaaaaaaaaaaaaaaaaaaa\\r\\nbfffffffacfffffffffa\\r\\nbgggggggaccgggggggga\\r\\nbbbbbbbbSccchhhhhhha\\r\\nbiiiiidddddcciiiiiia\\r\\nbjjjjjjddcccccjjjjja\\r\\nbkkkkkkkdddTaaaaaaaa\\r\\nbllllllllddbllllllla\\r\\nbmmmmmmmmmdbmmmmmmma\\r\\nbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['ccccc\\r\\n']}, {'input': '20 10 4\\r\\nbaaaaaaaaa\\r\\nbffacffffa\\r\\nbggaccggga\\r\\nbhhaccchha\\r\\nbiiaccccia\\r\\nbjjaccccca\\r\\nbkkakkkkka\\r\\nbllallllla\\r\\nbbbSmmmmma\\r\\nbnnnnnnnna\\r\\nbooooooooa\\r\\nbpppppTaaa\\r\\nbqqqqqbqqa\\r\\nbrrrrrbrra\\r\\nbdddddbssa\\r\\nbtddddbtta\\r\\nbuudddbuua\\r\\nbvvvddbvva\\r\\nbwwwwdbwwa\\r\\nbbbbbbbbbb\\r\\n', 'output': ['mmmno\\r\\n']}, {'input': '20 20 2\\r\\nbaaaaaaaaaaaaaaaaaaa\\r\\nbfffffffacfffffffffa\\r\\nbgggggggaccgggggggga\\r\\nbhhhhhhhaccchhhhhhha\\r\\nbiiiiiiiacccciiiiiia\\r\\nbjjjjjjjacccccjjjjja\\r\\nbkkkkkkkacccccckkkka\\r\\nblllllllacccccccllla\\r\\nbbbbbbbbSccccccccmma\\r\\nbddddddddddcccccccna\\r\\nbodddddddcccccccccca\\r\\nbppddddddddTaaaaaaaa\\r\\nbqqqdddddddbqqqqqqqa\\r\\nbrrrrddddddbrrrrrrra\\r\\nbsssssdddddbsssssssa\\r\\nbttttttddddbttttttta\\r\\nbuuuuuuudddbuuuuuuua\\r\\nbvvvvvvvvddbvvvvvvva\\r\\nbwwwwwwwwwdbwwwwwwwa\\r\\nbbbbbbbbbbbbbbbbbbbb\\r\\n', 'output': ['ccccc\\r\\n']}, {'input': '1 2 4\\r\\nST\\r\\n', 'output': ['\\r\\n']}, {'input': '3 3 1\\r\\naaa\\r\\naaa\\r\\nTSa\\r\\n', 'output': ['\\r\\n']}, {'input': '2 1 1\\r\\nS\\r\\nT\\r\\n', 'output': ['\\r\\n']}, {'input': '1 10 2\\r\\nbaaSaaTacb\\r\\n', 'output': ['aa\\r\\n']}, {'input': '2 1 4\\r\\nS\\r\\nT\\r\\n', 'output': ['\\r\\n']}]","id":179} {"description":"Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible.String s consists only of lowercase Latin letters, and it is allowed to change characters only to lowercase Latin letters too.","input_specification":"First line of input contains string s, consisting only of lowercase Latin letters (1\u2009\u2264\u2009|s|\u2009\u2264\u20091000, |s| denotes the length of s). Second line of input contains integer k (1\u2009\u2264\u2009k\u2009\u2264\u200926).","output_specification":"Print single line with a minimum number of necessary changes, or the word \u00abimpossible\u00bb (without quotes) if it is impossible.","notes":"NoteIn the first test case string contains 6 different letters, so we don't need to change anything.In the second test case string contains 4 different letters: {'a',\u2009'h',\u2009'o',\u2009'y'}. To get 5 different letters it is necessary to change one occurrence of 'o' to some letter, which doesn't occur in the string, for example, {'b'}.In the third test case, it is impossible to make 7 different letters because the length of the string is 6.","sample_inputs":["yandex\n6","yahoo\n5","google\n7"],"sample_outputs":["0","1","impossible"],"src_uid":"bd5912fe2c5c37658f28f6b159b39645","lang_cluster":"C","difficulty":1000,"human_solution":"#include\n#include\nint main()\n{\n\tchar s[1001];\n\tint i,k,count,j,freq[1001],count1;\n\t scanf(\"%s\",&s);\n\t scanf(\"%d\",&k);\n\n\tif(strlen(s) 0 && freq[d] < freq[d-1]) {\n t= freq[d];\n freq[d]= freq[d-1];\n freq[d-1] = t;\n d--;\n }\n\n }\n int size,freq2[1001],n=0;\n \/\/size = sizeof(freq)\/sizeof(int);\n for(i=0;i\n#include \n#include \n\nint main ()\n {\n unsigned short tf;\n unsigned char tm[7];\n unsigned short h;\n unsigned short m;\n \n if (scanf(\"%hu\",&tf) != 1)\n return -1;\n if (tf != 12 && tf != 24)\n return -1;\n if (scanf(\"%6s\",tm) != 1)\n return -1;\n if (strlen(tm) != 5)\n return -1;\n if (!isdigit(tm[0]) || !isdigit(tm[1]) || !isdigit(tm[3]) || !isdigit(tm[4]))\n return -1;\n if (tm[2] != ':')\n return -1;\n h = 10*(tm[0]-'0')+tm[1]-'0';\n m = 10*(tm[3]-'0')+tm[4]-'0';\n if (tf == 12 && !h)\n printf (\"01:\");\n else if (tf == 12 && h > 12)\n {\n if (tm[1] == '0')\n printf (\"10:\");\n else\n printf (\"0%c:\",tm[1]);\n }\n else if (tf == 24 && h > 23)\n printf (\"0%c:\",tm[1]);\n else\n printf (\"%c%c:\",tm[0],tm[1]);\n if (m > 59)\n printf (\"0%c\\n\",tm[4]);\n else\n printf (\"%c%c\\n\",tm[3],tm[4]);\n return 0;\n }\n","testcases":"[{'input': '24\\r\\n17:30\\r\\n', 'output': ['17:30\\r\\n']}, {'input': '12\\r\\n17:30\\r\\n', 'output': ['07:30\\r\\n']}, {'input': '24\\r\\n99:99\\r\\n', 'output': ['09:09\\r\\n']}, {'input': '12\\r\\n05:54\\r\\n', 'output': ['05:54\\r\\n']}, {'input': '12\\r\\n00:05\\r\\n', 'output': ['01:05\\r\\n']}, {'input': '24\\r\\n23:80\\r\\n', 'output': ['23:00\\r\\n']}, {'input': '24\\r\\n73:16\\r\\n', 'output': ['03:16\\r\\n']}, {'input': '12\\r\\n03:77\\r\\n', 'output': ['03:07\\r\\n']}, {'input': '12\\r\\n47:83\\r\\n', 'output': ['07:03\\r\\n']}, {'input': '24\\r\\n23:88\\r\\n', 'output': ['23:08\\r\\n']}, {'input': '24\\r\\n51:67\\r\\n', 'output': ['01:07\\r\\n']}, {'input': '12\\r\\n10:33\\r\\n', 'output': ['10:33\\r\\n']}, {'input': '12\\r\\n00:01\\r\\n', 'output': ['01:01\\r\\n']}, {'input': '12\\r\\n07:74\\r\\n', 'output': ['07:04\\r\\n']}, {'input': '12\\r\\n00:60\\r\\n', 'output': ['01:00\\r\\n']}, {'input': '24\\r\\n08:32\\r\\n', 'output': ['08:32\\r\\n']}, {'input': '24\\r\\n42:59\\r\\n', 'output': ['02:59\\r\\n']}, {'input': '24\\r\\n19:87\\r\\n', 'output': ['19:07\\r\\n']}, {'input': '24\\r\\n26:98\\r\\n', 'output': ['06:08\\r\\n']}, {'input': '12\\r\\n12:91\\r\\n', 'output': ['12:01\\r\\n']}, {'input': '12\\r\\n11:30\\r\\n', 'output': ['11:30\\r\\n']}, {'input': '12\\r\\n90:32\\r\\n', 'output': ['10:32\\r\\n']}, {'input': '12\\r\\n03:69\\r\\n', 'output': ['03:09\\r\\n']}, {'input': '12\\r\\n33:83\\r\\n', 'output': ['03:03\\r\\n']}, {'input': '24\\r\\n10:45\\r\\n', 'output': ['10:45\\r\\n']}, {'input': '24\\r\\n65:12\\r\\n', 'output': ['05:12\\r\\n']}, {'input': '24\\r\\n22:64\\r\\n', 'output': ['22:04\\r\\n']}, {'input': '24\\r\\n48:91\\r\\n', 'output': ['08:01\\r\\n']}, {'input': '12\\r\\n02:51\\r\\n', 'output': ['02:51\\r\\n']}, {'input': '12\\r\\n40:11\\r\\n', 'output': ['10:11\\r\\n']}, {'input': '12\\r\\n02:86\\r\\n', 'output': ['02:06\\r\\n']}, {'input': '12\\r\\n99:96\\r\\n', 'output': ['09:06\\r\\n']}, {'input': '24\\r\\n19:24\\r\\n', 'output': ['19:24\\r\\n']}, {'input': '24\\r\\n55:49\\r\\n', 'output': ['05:49\\r\\n']}, {'input': '24\\r\\n01:97\\r\\n', 'output': ['01:07\\r\\n']}, {'input': '24\\r\\n39:68\\r\\n', 'output': ['09:08\\r\\n']}, {'input': '24\\r\\n24:00\\r\\n', 'output': ['04:00\\r\\n']}, {'input': '12\\r\\n91:00\\r\\n', 'output': ['01:00\\r\\n']}, {'input': '24\\r\\n00:30\\r\\n', 'output': ['00:30\\r\\n']}, {'input': '12\\r\\n13:20\\r\\n', 'output': ['03:20\\r\\n']}, {'input': '12\\r\\n13:00\\r\\n', 'output': ['03:00\\r\\n']}, {'input': '12\\r\\n42:35\\r\\n', 'output': ['02:35\\r\\n']}, {'input': '12\\r\\n20:00\\r\\n', 'output': ['10:00\\r\\n']}, {'input': '12\\r\\n21:00\\r\\n', 'output': ['01:00\\r\\n']}, {'input': '24\\r\\n10:10\\r\\n', 'output': ['10:10\\r\\n']}, {'input': '24\\r\\n30:40\\r\\n', 'output': ['00:40\\r\\n']}, {'input': '24\\r\\n12:00\\r\\n', 'output': ['12:00\\r\\n']}, {'input': '12\\r\\n10:60\\r\\n', 'output': ['10:00\\r\\n']}, {'input': '24\\r\\n30:00\\r\\n', 'output': ['00:00\\r\\n']}, {'input': '24\\r\\n34:00\\r\\n', 'output': ['04:00\\r\\n']}, {'input': '12\\r\\n22:00\\r\\n', 'output': ['02:00\\r\\n']}, {'input': '12\\r\\n20:20\\r\\n', 'output': ['10:20\\r\\n']}]","id":181} {"description":"There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.New parliament assembly hall is a rectangle consisting of a\u2009\u00d7\u2009b chairs\u00a0\u2014 a rows of b chairs each. Two chairs are considered neighbouring if they share as side. For example, chair number 5 in row number 2 is neighbouring to chairs number 4 and 6 in this row and chairs with number 5 in rows 1 and 3. Thus, chairs have four neighbours in general, except for the chairs on the border of the hallWe know that if two parliamentarians from one political party (that is two Democrats or two Republicans) seat nearby they spent all time discussing internal party issues.Write the program that given the number of parliamentarians and the sizes of the hall determine if there is a way to find a seat for any parliamentarian, such that no two members of the same party share neighbouring seats.","input_specification":"The first line of the input contains three integers n, a and b (1\u2009\u2264\u2009n\u2009\u2264\u200910\u2009000, 1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009100)\u00a0\u2014 the number of parliamentarians, the number of rows in the assembly hall and the number of seats in each row, respectively.","output_specification":"If there is no way to assigns seats to parliamentarians in a proper way print -1. Otherwise print the solution in a lines, each containing b integers. The j-th integer of the i-th line should be equal to the index of parliamentarian occupying this seat, or 0 if this seat should remain empty. If there are multiple possible solution, you may print any of them.","notes":"NoteIn the first sample there are many other possible solutions. For example, 3 20 1and 2 13 0The following assignment 3 21 0is incorrect, because parliamentarians 1 and 3 are both from Democrats party but will occupy neighbouring seats.","sample_inputs":["3 2 2","8 4 3","10 2 2"],"sample_outputs":["0 3\n1 2","7 8 3\n0 1 4\n6 0 5\n0 2 0","-1"],"src_uid":"6e0dafeaf85e92f959c388c72e158f68","lang_cluster":"C","difficulty":1000,"human_solution":"#include \n\nint main(){\n\tint n, a, b, i, j, c;\n\tscanf(\"%d\", &n);\n\tscanf(\"%d\", &a);\n\tscanf(\"%d\", &b);\n\tc = 0;\n\tif (n>a*b) {\n\t\tprintf(\"-1\");\n\t\treturn 0;\n\t}\n\tif (b % 2 != 0) {\n\t\tfor (i = 0; i < a; i++){\n\t\t\tfor (j = 0; j < b; j++){\n\t\t\t\tif (c < n) {\n\t\t\t\t\tprintf(\"%d\", c + 1);\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tprintf(\"0\");\n\t\t\t\t}\n\t\t\t\tif (j != b - 1)\n\t\t\t\t\tprintf(\" \");\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t} else {\n\t\tfor (i = 0; i < a; i++) {\n\t\t\tfor (j = 0; j < b; j = j + 2){\n\t\t\t\tif (c < n -1){\n\t\t\t\t\tif (i % 2 == 0){\n\t\t\t\t\t\tprintf(\"%d %d\", c + 1, c + 2);\n\t\t\t\t\t\tc = c + 2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprintf(\"%d %d\", c + 2, c + 1);\n\t\t\t\t\t\tc = c + 2;\n\t\t\t\t\t}\n\t\t\t\t} else if (c == n - 1) {\n\t\t\t\t\tif (i % 2 == 0){\n\t\t\t\t\t\tprintf(\"%d %d\", c + 1, 0);\n\t\t\t\t\t\tc = c + 2;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprintf(\"%d %d\", 0, c + 1);\n\t\t\t\t\t\tc = c + 2;\n\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t} else {\n\t\t\t\t\tprintf(\"0 0\");\n\t\t\t\t}\n\n\t\t\t\tif (j != b - 2)\n\t\t\t\t\tprintf(\" \");\n\t\t\t}\n\t\t\tprintf(\"\\n\");\n\t\t}\n\t}\n\treturn 0;\n}","testcases":"[{'input': '3 2 2\\r\\n', 'output': ['1 2 \\r\\n0 3 \\r\\n']}, {'input': '8 4 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 0 \\r\\n0 0 0 \\r\\n']}, {'input': '10 2 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1\\r\\n', 'output': ['1 \\r\\n']}, {'input': '8 3 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 0 \\r\\n']}, {'input': '1 1 100\\r\\n', 'output': ['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 \\r\\n']}, {'input': '1 100 1\\r\\n', 'output': ['1 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n0 \\r\\n']}, {'input': '12 4 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 9 \\r\\n10 11 12 \\r\\n']}, {'input': '64 8 9\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 \\r\\n10 11 12 13 14 15 16 17 18 \\r\\n19 20 21 22 23 24 25 26 27 \\r\\n28 29 30 31 32 33 34 35 36 \\r\\n37 38 39 40 41 42 43 44 45 \\r\\n46 47 48 49 50 51 52 53 54 \\r\\n55 56 57 58 59 60 61 62 63 \\r\\n64 0 0 0 0 0 0 0 0 \\r\\n']}, {'input': '13 2 6\\r\\n', 'output': ['-1\\r\\n']}, {'input': '41 6 7\\r\\n', 'output': ['1 2 3 4 5 6 7 \\r\\n8 9 10 11 12 13 14 \\r\\n15 16 17 18 19 20 21 \\r\\n22 23 24 25 26 27 28 \\r\\n29 30 31 32 33 34 35 \\r\\n36 37 38 39 40 41 0 \\r\\n']}, {'input': '10000 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '26 1 33\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 0 0 0 0 0 0 0 \\r\\n']}, {'input': '3 1 6\\r\\n', 'output': ['1 2 3 0 0 0 \\r\\n']}, {'input': '109 37 3\\r\\n', 'output': ['1 2 3 \\r\\n4 5 6 \\r\\n7 8 9 \\r\\n10 11 12 \\r\\n13 14 15 \\r\\n16 17 18 \\r\\n19 20 21 \\r\\n22 23 24 \\r\\n25 26 27 \\r\\n28 29 30 \\r\\n31 32 33 \\r\\n34 35 36 \\r\\n37 38 39 \\r\\n40 41 42 \\r\\n43 44 45 \\r\\n46 47 48 \\r\\n49 50 51 \\r\\n52 53 54 \\r\\n55 56 57 \\r\\n58 59 60 \\r\\n61 62 63 \\r\\n64 65 66 \\r\\n67 68 69 \\r\\n70 71 72 \\r\\n73 74 75 \\r\\n76 77 78 \\r\\n79 80 81 \\r\\n82 83 84 \\r\\n85 86 87 \\r\\n88 89 90 \\r\\n91 92 93 \\r\\n94 95 96 \\r\\n97 98 99 \\r\\n100 101 102 \\r\\n103 104 105 \\r\\n106 107 108 \\r\\n109 0 0 \\r\\n']}, {'input': '15 2 8\\r\\n', 'output': ['1 2 3 4 5 6 7 8 \\r\\n10 9 12 11 14 13 0 15 \\r\\n']}, {'input': '29 3 11\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 10 11 \\r\\n12 13 14 15 16 17 18 19 20 21 22 \\r\\n23 24 25 26 27 28 29 0 0 0 0 \\r\\n']}, {'input': '16 18 1\\r\\n', 'output': ['1 \\r\\n2 \\r\\n3 \\r\\n4 \\r\\n5 \\r\\n6 \\r\\n7 \\r\\n8 \\r\\n9 \\r\\n10 \\r\\n11 \\r\\n12 \\r\\n13 \\r\\n14 \\r\\n15 \\r\\n16 \\r\\n0 \\r\\n0 \\r\\n']}, {'input': '46 3 16\\r\\n', 'output': ['1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 \\r\\n18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 \\r\\n33 34 35 36 37 38 39 40 41 42 43 44 45 46 0 0 \\r\\n']}, {'input': '4206 86 12\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2358 14 56\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5420 35 96\\r\\n', 'output': ['-1\\r\\n']}, {'input': '7758 63 41\\r\\n', 'output': ['-1\\r\\n']}, {'input': '9806 87 93\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99 1 97\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1053 25 42\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4217 49 86\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2312 77 30\\r\\n', 'output': ['-1\\r\\n']}, {'input': '74 1 71\\r\\n', 'output': ['-1\\r\\n']}]","id":182} {"description":"Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a \"domino show\".Chris arranges n dominoes in a line, placing each piece vertically upright. In the beginning, he simultaneously pushes some of the dominoes either to the left or to the right. However, somewhere between every two dominoes pushed in the same direction there is at least one domino pushed in the opposite direction.After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right push their adjacent dominoes standing on the right. When a vertical domino has dominoes falling on it from both sides, it stays still due to the balance of the forces. The figure shows one possible example of the process. Given the initial directions Chris has pushed the dominoes, find the number of the dominoes left standing vertically at the end of the process!","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u20093000), the number of the dominoes in the line. The next line contains a character string s of length n. The i-th character of the string si is equal to \"L\", if the i-th domino has been pushed to the left; \"R\", if the i-th domino has been pushed to the right; \".\", if the i-th domino has not been pushed. It is guaranteed that if si\u2009=\u2009sj\u2009=\u2009\"L\" and i\u2009<\u2009j, then there exists such k that i\u2009<\u2009k\u2009<\u2009j and sk\u2009=\u2009\"R\"; if si\u2009=\u2009sj\u2009=\u2009\"R\" and i\u2009<\u2009j, then there exists such k that i\u2009<\u2009k\u2009<\u2009j and sk\u2009=\u2009\"L\".","output_specification":"Output a single integer, the number of the dominoes that remain vertical at the end of the process.","notes":"NoteThe first example case is shown on the figure. The four pieces that remain standing vertically are highlighted with orange.In the second example case, all pieces fall down since the first piece topples all the other pieces.In the last example case, a single piece has not been pushed in either direction.","sample_inputs":["14\n.L.R...LR..L..","5\nR....","1\n."],"sample_outputs":["4","0","1"],"src_uid":"54c748dd983b6a0ea1af1153d08f1c01","lang_cluster":"C","difficulty":1100,"human_solution":"#include \nchar a[3002];\n\nint main(void) {\n int n ,i, l=0, r=0, count=0,s=0;\n scanf(\"%d\",&n);\n scanf(\"%s\",a);\n for(i=0; i\nmain()\n{\n int n,p=0,i,j;\n scanf(\"%d\",&n);\n \n int a[n],h[10000]={0};\n for(i=0;in)\n p++;\n \n h[a[i]]++;\n }\n for(j=0;j<=n;j++)\n {\n if(h[j]>1)\n p=p+h[j]-1; \n \n }\n printf(\"%d\",p);\n}\n","testcases":"[{'input': '3\\r\\n3 1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n2 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n5 3 3 3 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n6 6 6 6 6\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n1 1 2 2 8 8 7 7 9 9\\r\\n', 'output': ['5\\r\\n']}, {'input': '8\\r\\n9 8 7 6 5 4 3 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '15\\r\\n1 2 3 4 5 5 4 3 2 1 1 2 3 4 5\\r\\n', 'output': ['10\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['0\\r\\n']}, {'input': '1\\r\\n5000\\r\\n', 'output': ['1\\r\\n']}, {'input': '4\\r\\n5000 5000 5000 5000\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n3366 3461 4 5 4370\\r\\n', 'output': ['3\\r\\n']}, {'input': '10\\r\\n8 2 10 3 4 6 1 7 9 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '10\\r\\n551 3192 3213 2846 3068 1224 3447 1 10 9\\r\\n', 'output': ['7\\r\\n']}, {'input': '15\\r\\n4 1459 12 4281 3241 2748 10 3590 14 845 3518 1721 2 2880 1974\\r\\n', 'output': ['10\\r\\n']}, {'input': '15\\r\\n15 1 8 2 13 11 12 7 3 14 6 10 9 4 5\\r\\n', 'output': ['0\\r\\n']}, {'input': '15\\r\\n2436 2354 4259 1210 2037 2665 700 3578 2880 973 1317 1024 24 3621 4142\\r\\n', 'output': ['15\\r\\n']}, {'input': '30\\r\\n28 1 3449 9 3242 4735 26 3472 15 21 2698 7 4073 3190 10 3 29 1301 4526 22 345 3876 19 12 4562 2535 2 630 18 27\\r\\n', 'output': ['14\\r\\n']}, {'input': '100\\r\\n50 39 95 30 66 78 2169 4326 81 31 74 34 80 40 19 48 97 63 82 6 88 16 21 57 92 77 10 1213 17 93 32 91 38 4375 29 75 44 22 4 45 14 2395 3254 59 3379 2 85 96 8 83 27 94 1512 2960 100 9 73 79 7 25 55 69 90 99 51 87 98 62 18 35 43 4376 4668 28 72 56 4070 61 65 36 54 4106 11 24 15 86 70 71 4087 23 13 76 20 4694 26 4962 4726 37 14 64\\r\\n', 'output': ['18\\r\\n']}, {'input': '100\\r\\n340 14 3275 2283 2673 1107 817 2243 1226 32 2382 3638 4652 418 68 4962 387 764 4647 159 1846 225 2760 4904 3150 403 3 2439 91 4428 92 4705 75 348 1566 1465 69 6 49 4 62 4643 564 1090 3447 1871 2255 139 24 99 2669 969 86 61 4550 158 4537 3993 1589 872 2907 1888 401 80 1825 1483 63 1 2264 4068 4113 2548 41 885 4806 36 67 167 4447 34 1248 2593 82 202 81 1783 1284 4973 16 43 95 7 865 2091 3008 1793 20 947 4912 3604\\r\\n', 'output': ['70\\r\\n']}, {'input': '1\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n5000 5000\\r\\n', 'output': ['2\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n2 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n3 4\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n1 2 3 4 5 6 7 1000 10 10\\r\\n', 'output': ['2\\r\\n']}]","id":184} {"description":"Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the game begins. There are n boys playing football in the yard (including Petya), each boy's football playing skill is expressed with a non-negative characteristic ai (the larger it is, the better the boy plays). Let's denote the number of players in the first team as x, the number of players in the second team as y, the individual numbers of boys who play for the first team as pi and the individual numbers of boys who play for the second team as qi. Division n boys into two teams is considered fair if three conditions are fulfilled: Each boy plays for exactly one team (x\u2009+\u2009y\u2009=\u2009n). The sizes of teams differ in no more than one (|x\u2009-\u2009y|\u2009\u2264\u20091). The total football playing skills for two teams differ in no more than by the value of skill the best player in the yard has. More formally: Your task is to help guys divide into two teams fairly. It is guaranteed that a fair division into two teams always exists.","input_specification":"The first line contains the only integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1\u2009\u2264\u2009ai\u2009\u2264\u2009104), the i-th number represents the i-th boy's playing skills. ","output_specification":"On the first line print an integer x \u2014 the number of boys playing for the first team. On the second line print x integers \u2014 the individual numbers of boys playing for the first team. On the third line print an integer y \u2014 the number of boys playing for the second team, on the fourth line print y integers \u2014 the individual numbers of boys playing for the second team. Don't forget that you should fulfil all three conditions: x\u2009+\u2009y\u2009=\u2009n, |x\u2009-\u2009y|\u2009\u2264\u20091, and the condition that limits the total skills. If there are multiple ways to solve the problem, print any of them. The boys are numbered starting from one in the order in which their skills are given in the input data. You are allowed to print individual numbers of boys who belong to the same team in any order.","notes":"NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2\u2009-\u20091|\u2009=\u20091\u2009\u2264\u20091) is fulfilled, the third limitation on the difference in skills ((2\u2009+\u20091)\u2009-\u2009(1)\u2009=\u20092\u2009\u2264\u20092) is fulfilled.","sample_inputs":["3\n1 2 1","5\n2 3 3 1 1"],"sample_outputs":["2\n1 2 \n1\n3","3\n4 1 3 \n2\n5 2"],"src_uid":"0937a7e2f912fc094cc4275fd47cd457","lang_cluster":"C","difficulty":1500,"human_solution":"#include \nstruct play{\n int skill;\n int position;\n};\ntypedef struct play player;\n\ntypedef int (*compfn)(const void*, const void*);\n\nint compare(struct play *, struct play *);\n\nint main(){\n int n, x=0, y=0;\n int i, j;\n\n scanf(\"%d\", &n);\n\n player players[n];\n\n for(i=0; iskill < elem2->skill)\n return -1;\n\n else if (elem1->skill > elem2->skill)\n return 1;\n\n else\n return 0;\n}","testcases":"[{'input': '3\\r\\n1 2 1\\r\\n', 'output': ['2\\r\\n1 2 \\r\\n1\\r\\n3 \\r\\n']}, {'input': '5\\r\\n2 3 3 1 1\\r\\n', 'output': ['3\\r\\n4 1 3 \\r\\n2\\r\\n5 2 \\r\\n']}, {'input': '10\\r\\n2 2 2 2 2 2 2 1 2 2\\r\\n', 'output': ['5\\r\\n8 2 4 6 9 \\r\\n5\\r\\n1 3 5 7 10 \\r\\n']}, {'input': '10\\r\\n2 3 3 1 3 1 1 1 2 2\\r\\n', 'output': ['5\\r\\n4 7 1 10 3 \\r\\n5\\r\\n6 8 9 2 5 \\r\\n']}, {'input': '10\\r\\n2 3 2 3 3 1 1 3 1 1\\r\\n', 'output': ['5\\r\\n6 9 1 2 5 \\r\\n5\\r\\n7 10 3 4 8 \\r\\n']}, {'input': '11\\r\\n1 3 1 2 1 2 2 2 1 1 1\\r\\n', 'output': ['6\\r\\n1 5 10 4 7 2 \\r\\n5\\r\\n3 9 11 6 8 \\r\\n']}, {'input': '11\\r\\n54 83 96 75 33 27 36 35 26 22 77\\r\\n', 'output': ['6\\r\\n10 6 8 1 11 3 \\r\\n5\\r\\n9 5 7 4 2 \\r\\n']}, {'input': '11\\r\\n1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['6\\r\\n1 3 5 7 9 11 \\r\\n5\\r\\n2 4 6 8 10 \\r\\n']}, {'input': '2\\r\\n1 1\\r\\n', 'output': ['1\\r\\n1 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '2\\r\\n35 36\\r\\n', 'output': ['1\\r\\n1 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '25\\r\\n1 2 2 1 2 2 2 2 2 1 1 2 2 2 2 2 1 2 2 2 1 1 2 2 1\\r\\n', 'output': ['13\\r\\n1 10 17 22 2 5 7 9 13 15 18 20 24 \\r\\n12\\r\\n4 11 21 25 3 6 8 12 14 16 19 23 \\r\\n']}, {'input': '27\\r\\n2 1 1 3 1 2 1 1 3 2 3 1 3 2 1 3 2 3 2 1 2 3 2 2 1 2 1\\r\\n', 'output': ['14\\r\\n2 5 8 15 25 1 10 17 21 24 4 11 16 22 \\r\\n13\\r\\n3 7 12 20 27 6 14 19 23 26 9 13 18 \\r\\n']}, {'input': '30\\r\\n2 2 2 3 4 3 4 4 3 2 3 2 2 4 1 4 2 4 2 2 1 4 3 2 1 3 1 1 4 3\\r\\n', 'output': ['15\\r\\n15 25 28 2 10 13 19 24 6 11 26 5 8 16 22 \\r\\n15\\r\\n21 27 1 3 12 17 20 4 9 23 30 7 14 18 29 \\r\\n']}, {'input': '100\\r\\n3 4 8 10 8 6 4 3 7 7 6 2 3 1 3 10 1 7 9 3 5 5 2 6 2 9 1 7 4 2 4 1 6 1 7 10 2 5 3 7 6 4 6 2 8 8 8 6 6 10 3 7 4 3 4 1 7 9 3 6 3 6 1 4 9 3 8 1 10 1 4 10 7 7 9 5 3 8 10 2 1 10 8 7 10 8 5 3 1 2 1 10 6 1 5 3 3 5 7 2\\r\\n', 'output': ['50\\r\\n14 27 34 63 70 89 94 23 30 44 90 1 13 20 51 59 66 88 97 7 31 53 64 21 38 87 98 11 33 43 49 62 9 18 35 52 73 84 3 45 47 78 86 26 65 4 36 69 79 85 \\r\\n50\\r\\n17 32 56 68 81 91 12 25 37 80 100 8 15 39 54 61 77 96 2 29 42 55 71 22 76 95 6 24 41 48 60 93 10 28 40 57 74 99 5 46 67 83 19 58 75 16 50 72 82 92 \\r\\n']}, {'input': '100\\r\\n85 50 17 89 65 89 5 20 86 26 16 21 85 14 44 31 87 31 6 2 48 67 8 80 79 1 48 36 97 1 5 30 79 50 78 12 2 55 76 100 54 40 26 81 97 96 68 56 87 14 51 17 54 37 52 33 69 62 38 63 74 15 62 78 9 19 67 2 60 58 93 60 18 96 55 48 34 7 79 82 32 58 90 67 20 50 27 15 7 89 98 10 11 15 99 49 4 51 77 52\\r\\n', 'output': ['50\\r\\n26 20 68 7 19 89 65 93 14 62 94 3 73 8 12 43 32 18 56 28 59 15 27 96 34 51 55 41 38 48 82 72 63 5 67 47 61 99 64 33 24 80 13 17 4 90 71 74 45 95 \\r\\n50\\r\\n30 37 97 31 78 23 92 36 50 88 11 52 66 85 10 87 16 81 77 54 42 21 76 2 86 98 100 53 75 70 69 58 60 22 84 57 39 35 25 79 44 1 9 49 6 83 46 29 91 40 \\r\\n']}, {'input': '100\\r\\n2382 7572 9578 1364 2325 2929 7670 5574 2836 2440 6553 1751 929 8785 6894 9373 9308 7338 6380 9541 9951 6785 8993 9942 5087 7544 6582 7139 8458 7424 9759 8199 9464 8817 7625 6200 4955 9373 9500 3062 849 4210 9337 5466 2190 8150 4971 3145 869 5675 1975 161 1998 378 5229 9000 8958 761 358 434 7636 8295 4406 73 375 812 2473 3652 9067 3052 5287 2850 6987 5442 2625 8894 8733 791 9763 5258 8259 9530 2050 7334 2118 2726 8221 5527 8827 1585 8334 8898 6399 6217 7400 2576 5164 9063 6247 9433\\r\\n', 'output': ['50\\r\\n64 59 54 58 66 49 4 12 53 85 5 10 96 86 72 70 48 42 37 25 55 71 44 8 36 99 93 27 15 28 18 30 2 61 46 87 62 29 14 89 92 23 98 17 16 100 39 20 31 24 \\r\\n50\\r\\n52 65 60 78 41 13 90 51 83 45 1 67 75 9 6 40 68 63 47 97 80 74 88 50 94 19 11 22 73 84 95 26 35 7 32 81 91 77 34 76 57 56 69 43 38 33 82 3 79 21 \\r\\n']}, {'input': '3\\r\\n1 2 3\\r\\n', 'output': ['2\\r\\n1 3 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '3\\r\\n10 10 10\\r\\n', 'output': ['2\\r\\n1 3 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '3\\r\\n5 10 10\\r\\n', 'output': ['2\\r\\n1 3 \\r\\n1\\r\\n2 \\r\\n']}, {'input': '5\\r\\n6 1 1 1 1\\r\\n', 'output': ['3\\r\\n2 4 1 \\r\\n2\\r\\n3 5 \\r\\n']}, {'input': '5\\r\\n1 100 2 200 3\\r\\n', 'output': ['3\\r\\n1 5 4 \\r\\n2\\r\\n3 2 \\r\\n']}]","id":185} {"description":"One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1\u2009\u2264\u2009i\u2009<\u2009j\u2009\u2264\u2009n, 1\u2009\u2264\u2009k\u2009\u2264\u2009m), then he took names number i and j and swapped their prefixes of length k. For example, if we take names \"CBDAD\" and \"AABRD\" and swap their prefixes with the length of 3, the result will be names \"AABAD\" and \"CBDRD\".You wonder how many different names Vasya can write instead of name number 1, if Vasya is allowed to perform any number of the described actions. As Vasya performs each action, he chooses numbers i, j, k independently from the previous moves and his choice is based entirely on his will. The sought number can be very large, so you should only find it modulo 1000000007 (109\u2009+\u20097).","input_specification":"The first input line contains two integers n and m (1\u2009\u2264\u2009n,\u2009m\u2009\u2264\u2009100) \u2014 the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.","output_specification":"Print the single number \u2014 the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109\u2009+\u20097).","notes":"NoteIn the first sample Vasya can get the following names in the position number 1: \"AAB\", \"AAA\", \"BAA\" and \"BAB\".","sample_inputs":["2 3\nAAB\nBAA","4 5\nABABA\nBCGDG\nAAAAA\nYABSA"],"sample_outputs":["4","216"],"src_uid":"a37df9b239a40473516d1525d56a0da7","lang_cluster":"C","difficulty":1400,"human_solution":"#include \n#include \n\nint main(void)\n{\n char buf = '\\0';\n unsigned long long int result = 0;\n unsigned long long int variants = 0;\n int symbols[100][26] = {{0}};\n\/\/ FILE *f = 0;\n int N = 0,M = 0,n=0,m=0,i=0;\n\n\/\/ f = fopen(\"input.txt\",\"rt\");\n\n scanf(\"%d %d\\n\",&N,&M);\n\n for (n=0;n\n#include\nint main()\n{int n,m,i,j,k;\nchar a[102][102],str[102][102];\nscanf(\"%d%d\",&n,&m);\nfor(i=0;i\n\nint cloth[101][101], price[101];\n\nint main()\n\n{\n\nint n, m, i, j, k, x, y, cost, min;\n\nwhile(scanf(\"%d%d\", &n, &m)!=EOF)\n\n{\n\ncost=0; min=0xffffff;\n\nfor(i=1; i<=n; i++)\n\nscanf(\"%d\", &price[i]);\n\nfor(i=0; i\n\n#include \n\n\ntypedef struct link1\n{\n int d;\n struct link1 *next;\n}node;\n\nnode *a[100005];\nint n,s,d;\nint top=-1;\n\/\/int front,rear;\nint visited[100005];\n\/\/int q[100000][2];\n\n\nvoid print()\n{\n int i;\n for(i=1;i<=n;i++)\n {\n node *v=a[i];\n while(v!=NULL)\n {\n printf(\"%d \",v->d);\n v=v->next;\n }\n printf(\"\\n\");\n }\n}\n\nint parent[100005];\n\nint find(int i)\n{\n while(parent[i]!=-1)\n {\n i=parent[i];\n }\n return i;\n}\n\n\nvoid Union(int x,int y)\n{\n parent[find(x)]=find(y);\n}\n\nvoid dfs(node *v,int depth)\n{\n \/\/ flag1=0;\n visited[v->d]=1;\n \/\/ printf(\"%d \",v->d);\n if(v->next==NULL)\n return;\n else\n {\n v=v->next;\n while(v!=NULL)\n {\n int r=v->d;\n if(visited[r]==0)\n {\n visited[r]=1;\n dfs(a[r],depth+1);\n }\n v=v->next;\n \/\/ dfs(v->next->next,depth+1);\n }\n }\n}\n\nint main()\n{\n int m,i,x,y;\n scanf(\"%d %d\",&n,&m);\n \/\/ a=(node *)malloc(n*sizeof(node));\n for(i=1;i<=n;i++)\n {\n a[i]=(node *)malloc(sizeof(node));\n a[i]->d=i;\n a[i]->next=NULL;\n visited[i]=0;\n parent[i]=-1;\n }\n int flag=0;\n for(i=0;id=x;\n q->next=a[y]->next;\n p->d=y;\n p->next=a[x]->next;\n a[x]->next=p;\n a[y]->next=q;\n \/\/ print();\n }\n if(n!=m)\n {\n printf(\"NO\\n\");\n return 0;\n }\n dfs(a[1],0);\n \/* for(i=0;i<=n;i++)\n {\n parent[i]=-1;\n }*\/\n for(i=1;i<=n;i++)\n {\n if(visited[i]!=1)\n {\n printf(\"NO\\n\");\n return 0;\n }\n \/\/ printf(\"parent[%d]=%d\\n\",i,find(i));\n }\n if(flag==1)\n printf(\"FHTAGN!\\n\");\n else\n printf(\"NO\\n\");\n return 0;\n}\n\n\n\n","testcases":"[{'input': '6 6\\r\\n6 3\\r\\n6 4\\r\\n5 1\\r\\n2 5\\r\\n1 4\\r\\n5 4\\r\\n', 'output': ['FHTAGN!']}, {'input': '6 5\\r\\n5 6\\r\\n4 6\\r\\n3 1\\r\\n5 1\\r\\n1 2\\r\\n', 'output': ['NO']}, {'input': '10 10\\r\\n4 10\\r\\n8 5\\r\\n2 8\\r\\n4 9\\r\\n9 3\\r\\n2 7\\r\\n10 6\\r\\n10 2\\r\\n9 8\\r\\n1 8\\r\\n', 'output': ['FHTAGN!']}, {'input': '5 4\\r\\n1 5\\r\\n1 3\\r\\n1 4\\r\\n3 2\\r\\n', 'output': ['NO']}, {'input': '12 12\\r\\n4 12\\r\\n4 7\\r\\n4 9\\r\\n7 2\\r\\n5 12\\r\\n2 1\\r\\n5 9\\r\\n8 6\\r\\n10 12\\r\\n2 5\\r\\n10 9\\r\\n12 3\\r\\n', 'output': ['NO']}, {'input': '12 15\\r\\n3 2\\r\\n11 12\\r\\n1 9\\r\\n2 1\\r\\n1 8\\r\\n9 6\\r\\n11 5\\r\\n9 5\\r\\n9 10\\r\\n11 3\\r\\n7 11\\r\\n5 6\\r\\n11 10\\r\\n4 6\\r\\n4 2\\r\\n', 'output': ['NO']}, {'input': '12 10\\r\\n1 11\\r\\n3 6\\r\\n5 7\\r\\n4 7\\r\\n6 8\\r\\n11 7\\r\\n3 12\\r\\n11 12\\r\\n7 9\\r\\n12 2\\r\\n', 'output': ['NO']}, {'input': '1 0\\r\\n', 'output': ['NO']}, {'input': '2 1\\r\\n1 2\\r\\n', 'output': ['NO']}, {'input': '3 1\\r\\n1 3\\r\\n', 'output': ['NO']}, {'input': '3 2\\r\\n1 2\\r\\n2 3\\r\\n', 'output': ['NO']}, {'input': '3 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['FHTAGN!']}, {'input': '4 4\\r\\n1 2\\r\\n3 4\\r\\n4 1\\r\\n2 4\\r\\n', 'output': ['FHTAGN!']}, {'input': '6 6\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n4 5\\r\\n5 6\\r\\n6 4\\r\\n', 'output': ['NO']}, {'input': '2 0\\r\\n', 'output': ['NO']}, {'input': '3 0\\r\\n', 'output': ['NO']}, {'input': '100 0\\r\\n', 'output': ['NO']}, {'input': '100 1\\r\\n11 23\\r\\n', 'output': ['NO']}, {'input': '10 10\\r\\n5 7\\r\\n8 1\\r\\n10 3\\r\\n6 4\\r\\n10 6\\r\\n5 3\\r\\n5 6\\r\\n2 6\\r\\n4 3\\r\\n2 10\\r\\n', 'output': ['NO']}, {'input': '20 20\\r\\n9 10\\r\\n4 19\\r\\n9 20\\r\\n12 20\\r\\n1 15\\r\\n2 12\\r\\n19 10\\r\\n19 15\\r\\n4 10\\r\\n4 8\\r\\n8 9\\r\\n20 8\\r\\n6 2\\r\\n2 15\\r\\n7 19\\r\\n20 4\\r\\n3 16\\r\\n1 20\\r\\n9 1\\r\\n20 10\\r\\n', 'output': ['NO']}, {'input': '30 30\\r\\n17 6\\r\\n16 29\\r\\n16 13\\r\\n16 20\\r\\n29 26\\r\\n17 5\\r\\n27 28\\r\\n24 16\\r\\n7 18\\r\\n24 10\\r\\n1 27\\r\\n12 17\\r\\n27 30\\r\\n6 1\\r\\n3 30\\r\\n5 19\\r\\n18 13\\r\\n16 2\\r\\n30 1\\r\\n5 8\\r\\n14 16\\r\\n26 18\\r\\n7 19\\r\\n5 6\\r\\n23 14\\r\\n6 8\\r\\n23 8\\r\\n18 8\\r\\n18 3\\r\\n5 21\\r\\n', 'output': ['NO']}, {'input': '100 66\\r\\n41 14\\r\\n19 13\\r\\n70 43\\r\\n79 62\\r\\n9 62\\r\\n71 40\\r\\n53 86\\r\\n80 4\\r\\n34 33\\r\\n72 68\\r\\n40 96\\r\\n84 59\\r\\n36 77\\r\\n55 50\\r\\n40 3\\r\\n79 81\\r\\n3 43\\r\\n33 47\\r\\n22 98\\r\\n33 90\\r\\n56 49\\r\\n69 28\\r\\n73 30\\r\\n65 22\\r\\n98 20\\r\\n9 52\\r\\n54 20\\r\\n32 70\\r\\n51 80\\r\\n63 12\\r\\n21 48\\r\\n35 17\\r\\n48 87\\r\\n25 43\\r\\n65 80\\r\\n42 3\\r\\n86 35\\r\\n95 98\\r\\n43 59\\r\\n51 46\\r\\n66 37\\r\\n88 34\\r\\n32 47\\r\\n24 42\\r\\n21 44\\r\\n92 59\\r\\n81 6\\r\\n100 82\\r\\n85 6\\r\\n58 25\\r\\n66 6\\r\\n14 32\\r\\n59 85\\r\\n3 98\\r\\n44 4\\r\\n85 51\\r\\n69 41\\r\\n80 70\\r\\n81 24\\r\\n75 71\\r\\n93 9\\r\\n82 55\\r\\n70 46\\r\\n66 32\\r\\n77 58\\r\\n11 46\\r\\n', 'output': ['NO']}, {'input': '4 4\\r\\n1 2\\r\\n4 3\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['FHTAGN!']}, {'input': '5 5\\r\\n2 3\\r\\n2 4\\r\\n5 4\\r\\n4 1\\r\\n1 2\\r\\n', 'output': ['FHTAGN!']}, {'input': '10 10\\r\\n1 10\\r\\n5 9\\r\\n6 2\\r\\n8 9\\r\\n9 1\\r\\n5 4\\r\\n2 8\\r\\n1 3\\r\\n6 3\\r\\n4 1\\r\\n', 'output': ['NO']}, {'input': '6 6\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n4 5\\r\\n5 6\\r\\n6 4\\r\\n', 'output': ['NO']}, {'input': '4 3\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n', 'output': ['NO']}, {'input': '6 5\\r\\n1 2\\r\\n2 3\\r\\n3 1\\r\\n1 4\\r\\n1 5\\r\\n', 'output': ['NO']}]","id":189} {"description":"Little Petya loves inequations. Help him find n positive integers a1,\u2009a2,\u2009...,\u2009an, such that the following two conditions are satisfied: a12\u2009+\u2009a22\u2009+\u2009...\u2009+\u2009an2\u2009\u2265\u2009x a1\u2009+\u2009a2\u2009+\u2009...\u2009+\u2009an\u2009\u2264\u2009y","input_specification":"The first line contains three space-separated integers n, x and y (1\u2009\u2264\u2009n\u2009\u2264\u2009105,\u20091\u2009\u2264\u2009x\u2009\u2264\u20091012,\u20091\u2009\u2264\u2009y\u2009\u2264\u2009106). Please do not use the %lld specificator to read or write 64-bit integers in \u0421++. It is recommended to use cin, cout streams or the %I64d specificator.","output_specification":"Print n positive integers that satisfy the conditions, one integer per line. If such numbers do not exist, print a single number \"-1\". If there are several solutions, print any of them.","notes":null,"sample_inputs":["5 15 15","2 3 2","1 99 11"],"sample_outputs":["4\n4\n1\n1\n2","-1","11"],"src_uid":"138fd96bf5a677a6d59c20f88fd612f1","lang_cluster":"C","difficulty":1400,"human_solution":"#include\n\ntypedef unsigned long long int u_long;\n\nint main(void) {\n\tu_long x, y, n;\n\tu_long i, j, k;\n\tu_long sum = 0;\n\tscanf(\"%llu %llu %llu\", &n, &x, &y);\n\tif(y < n) {\n\t\tputs(\"-1\");\n\t\treturn 0;\n\t}\n\tsum = (y - n + 1) * (y - n + 1);\n\tsum += (n - 1);\n\tif(sum < x) {\n\t\tputs(\"-1\");\n\t} else {\n\t\tprintf(\"%llu\\n\", (y - n + 1));\n\t\tfor(i = 1; i < n; i++) puts(\"1\");\n\t}\n\treturn 0;\n}\n","testcases":"[{'input': '5 15 15\\r\\n', 'output': ['11\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '2 3 2\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 99 11\\r\\n', 'output': ['11\\r\\n']}, {'input': '3 254 18\\r\\n', 'output': ['16\\r\\n1\\r\\n1\\r\\n']}, {'input': '4 324 77\\r\\n', 'output': ['74\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '5 315 90\\r\\n', 'output': ['86\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '6 225 59\\r\\n', 'output': ['54\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '7 351 29\\r\\n', 'output': ['23\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '100 913723780421 955988\\r\\n', 'output': ['-1\\r\\n']}, {'input': '200 894176381082 945808\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1000 824905348050 909242\\r\\n', 'output': ['-1\\r\\n']}, {'input': '31000 819461299082 936240\\r\\n', 'output': ['-1\\r\\n']}, {'input': '44000 772772899626 923074\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99999 681508136225 925533\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99976 664640815001 915230\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100000 729199960625 953931\\r\\n', 'output': ['-1\\r\\n']}, {'input': '50 890543266647 943735\\r\\n', 'output': ['-1\\r\\n']}, {'input': '60 817630084499 904288\\r\\n', 'output': ['904229\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '99999 716046078026 946193\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10000 950051796437 984705\\r\\n', 'output': ['-1\\r\\n']}, {'input': '999 992972391401 997478\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 983300308227 991615\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 912219830404 955103\\r\\n', 'output': ['955102\\r\\n1\\r\\n']}, {'input': '3 934371623645 966631\\r\\n', 'output': ['-1\\r\\n']}, {'input': '4 857839030421 926199\\r\\n', 'output': ['-1\\r\\n']}, {'input': '7 897398130730 947317\\r\\n', 'output': ['-1\\r\\n']}, {'input': '60 833021290059 912759\\r\\n', 'output': ['912700\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '1 860113420929 927423\\r\\n', 'output': ['927423\\r\\n']}, {'input': '2 933669982757 966267\\r\\n', 'output': ['966266\\r\\n1\\r\\n']}, {'input': '3 933157932003 966003\\r\\n', 'output': ['966001\\r\\n1\\r\\n1\\r\\n']}, {'input': '4 944626542564 971922\\r\\n', 'output': ['971919\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '7 937519681542 968262\\r\\n', 'output': ['968256\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '100000 1000000000000 1000000\\r\\n', 'output': ['-1\\r\\n']}, {'input': '99999 999999999999 999999\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '11 10 10\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 5 10\\r\\n', 'output': ['10\\r\\n']}, {'input': '10 3 8\\r\\n', 'output': ['-1\\r\\n']}, {'input': '5 37 10\\r\\n', 'output': ['6\\r\\n1\\r\\n1\\r\\n1\\r\\n1\\r\\n']}, {'input': '5 1 4\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '1 1000000000000 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1 1000000\\r\\n', 'output': ['1000000\\r\\n']}, {'input': '100000 1 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100000 1000000000000 1\\r\\n', 'output': ['-1\\r\\n']}, {'input': '1 1000000000000 1000000\\r\\n', 'output': ['1000000\\r\\n']}]","id":190} {"description":"Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the first student with the second one as well as the second student with the first one.To restore order, Anna and Maria do the following. First, for each student Anna finds out what other students he is tied to. If a student is tied to exactly one other student, Anna reprimands him. Then Maria gathers in a single group all the students who have been just reprimanded. She kicks them out from the club. This group of students immediately leaves the club. These students takes with them the laces that used to tie them. Then again for every student Anna finds out how many other students he is tied to and so on. And they do so until Anna can reprimand at least one student.Determine how many groups of students will be kicked out of the club.","input_specification":"The first line contains two integers n and m \u2014 the initial number of students and laces (). The students are numbered from 1 to n, and the laces are numbered from 1 to m. Next m lines each contain two integers a and b \u2014 the numbers of students tied by the i-th lace (1\u2009\u2264\u2009a,\u2009b\u2009\u2264\u2009n,\u2009a\u2009\u2260\u2009b). It is guaranteed that no two students are tied with more than one lace. No lace ties a student to himself.","output_specification":"Print the single number \u2014 the number of groups of students that will be kicked out from the club.","notes":"NoteIn the first sample Anna and Maria won't kick out any group of students \u2014 in the initial position every student is tied to two other students and Anna won't be able to reprimand anyone.In the second sample four students are tied in a chain and two more are running by themselves. First Anna and Maria kick out the two students from both ends of the chain (1 and 4), then \u2014 two other students from the chain (2 and 3). At that the students who are running by themselves will stay in the club.In the third sample Anna and Maria will momentarily kick out all students except for the fourth one and the process stops at that point. The correct answer is one.","sample_inputs":["3 3\n1 2\n2 3\n3 1","6 3\n1 2\n2 3\n3 4","6 5\n1 4\n2 4\n3 4\n5 4\n6 4"],"sample_outputs":["0","2","1"],"src_uid":"f8315dc903b0542c453cab4577bcb20d","lang_cluster":"C","difficulty":1200,"human_solution":"#include\n#include\n\nint main()\n{\n\tint n,m;\n\tscanf(\"%d%d\",&n,&m);\n\tint a[105][2];\n\tint b[105][105];\n\tint c[105];\n\tmemset(a,0,sizeof(a));\n\tmemset(b,0,sizeof(b));\n\tmemset(c,0,sizeof(c));\n\tfor(int i=0;i\nint main(){\n\tint i,n,sum=0,t,arr[105];\n\tdouble s;\n\tscanf(\"%d%d\",&n,&t);\n\ts=t;\n\tfor(i=1;i<=n;i++){\n\t\tscanf(\"%d\",&arr[i]);\n\t\ts+=arr[i];\n\t}\n\ts\/=n;\n\tfor(i=1;i<=n;i++)\t\n\t\tif((s-arr[i])<0){\n\t\t\tprintf(\"-1\");\n\t\t\treturn 0;\n\t\t}\n\tfor(i=1;i<=n;i++)\n\t\tprintf(\"%f\\n\",s-arr[i]);\n\treturn 0;\n}\n","testcases":"[{'input': '5 50\\r\\n1 2 3 4 5\\r\\n', 'output': ['12.000000\\r\\n11.000000\\r\\n10.000000\\r\\n9.000000\\r\\n8.000000\\r\\n']}, {'input': '2 2\\r\\n1 100\\r\\n', 'output': ['-1\\r\\n']}, {'input': '2 2\\r\\n1 1\\r\\n', 'output': ['1.000000\\r\\n1.000000\\r\\n']}, {'input': '3 2\\r\\n1 2 1\\r\\n', 'output': ['1.000000\\r\\n0.000000\\r\\n1.000000\\r\\n']}, {'input': '3 5\\r\\n1 2 1\\r\\n', 'output': ['2.000000\\r\\n1.000000\\r\\n2.000000\\r\\n']}, {'input': '10 95\\r\\n0 0 0 0 0 1 1 1 1 1\\r\\n', 'output': ['10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n10.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n9.000000\\r\\n']}, {'input': '3 5\\r\\n1 2 3\\r\\n', 'output': ['2.666667\\r\\n1.666667\\r\\n0.666667\\r\\n']}, {'input': '3 5\\r\\n1 3 2\\r\\n', 'output': ['2.666667\\r\\n0.666667\\r\\n1.666667\\r\\n']}, {'input': '3 5\\r\\n2 1 3\\r\\n', 'output': ['1.666667\\r\\n2.666667\\r\\n0.666667\\r\\n']}, {'input': '3 5\\r\\n2 3 1\\r\\n', 'output': ['1.666667\\r\\n0.666667\\r\\n2.666667\\r\\n']}, {'input': '3 5\\r\\n3 1 2\\r\\n', 'output': ['0.666667\\r\\n2.666667\\r\\n1.666667\\r\\n']}, {'input': '3 5\\r\\n3 2 1\\r\\n', 'output': ['0.666667\\r\\n1.666667\\r\\n2.666667\\r\\n']}, {'input': '2 1\\r\\n1 1\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '2 1\\r\\n2 2\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '3 2\\r\\n2 1 2\\r\\n', 'output': ['0.333333\\r\\n1.333333\\r\\n0.333333\\r\\n']}, {'input': '3 3\\r\\n2 2 1\\r\\n', 'output': ['0.666667\\r\\n0.666667\\r\\n1.666667\\r\\n']}, {'input': '3 3\\r\\n3 1 2\\r\\n', 'output': ['0.000000\\r\\n2.000000\\r\\n1.000000\\r\\n']}, {'input': '100 100\\r\\n37 97 75 52 33 29 51 22 33 37 45 96 96 60 82 58 86 71 28 73 38 50 6 6 90 17 26 76 13 41 100 47 17 93 4 1 56 16 41 74 25 17 69 61 39 37 96 73 49 93 52 14 62 24 91 30 9 97 52 100 6 16 85 8 12 26 10 3 94 63 80 27 29 78 9 48 79 64 60 18 98 75 81 35 24 81 2 100 23 70 21 60 98 38 29 29 58 37 49 72\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 100\\r\\n1 3 7 7 9 5 9 3 7 8 10 1 3 10 10 6 1 3 10 4 3 9 4 9 5 4 9 2 8 7 4 3 3 3 5 10 8 9 10 1 9 2 4 8 3 10 9 2 3 9 8 2 4 4 4 7 1 1 7 3 7 8 9 5 1 2 6 7 1 10 9 10 5 10 1 10 5 2 4 3 10 1 6 5 6 7 8 9 3 8 6 10 8 7 2 3 8 6 3 6\\r\\n', 'output': ['-1\\r\\n']}, {'input': '100 61\\r\\n81 80 83 72 87 76 91 92 77 93 77 94 76 73 71 88 88 76 87 73 89 73 85 81 79 90 76 73 82 93 79 93 71 75 72 71 78 85 92 89 88 93 74 87 71 94 74 87 85 89 90 93 86 94 92 87 90 91 75 73 90 84 92 94 92 79 74 85 74 74 89 76 84 84 84 83 86 84 82 71 76 74 83 81 89 73 73 74 71 77 90 94 73 94 73 75 93 89 84 92\\r\\n', 'output': ['-1\\r\\n']}, {'input': '10 100\\r\\n52 52 51 52 52 52 51 51 52 52\\r\\n', 'output': ['9.700000\\r\\n9.700000\\r\\n10.700000\\r\\n9.700000\\r\\n9.700000\\r\\n9.700000\\r\\n10.700000\\r\\n10.700000\\r\\n9.700000\\r\\n9.700000\\r\\n']}, {'input': '10 100\\r\\n13 13 13 13 12 13 12 13 12 12\\r\\n', 'output': ['9.600000\\r\\n9.600000\\r\\n9.600000\\r\\n9.600000\\r\\n10.600000\\r\\n9.600000\\r\\n10.600000\\r\\n9.600000\\r\\n10.600000\\r\\n10.600000\\r\\n']}, {'input': '10 100\\r\\n50 51 47 51 48 46 49 51 46 51\\r\\n', 'output': ['9.000000\\r\\n8.000000\\r\\n12.000000\\r\\n8.000000\\r\\n11.000000\\r\\n13.000000\\r\\n10.000000\\r\\n8.000000\\r\\n13.000000\\r\\n8.000000\\r\\n']}, {'input': '10 100\\r\\n13 13 9 12 12 11 13 8 10 13\\r\\n', 'output': ['8.400000\\r\\n8.400000\\r\\n12.400000\\r\\n9.400000\\r\\n9.400000\\r\\n10.400000\\r\\n8.400000\\r\\n13.400000\\r\\n11.400000\\r\\n8.400000\\r\\n']}, {'input': '13 97\\r\\n52 52 51 51 52 52 51 52 51 51 52 52 52\\r\\n', 'output': ['7.076923\\r\\n7.076923\\r\\n8.076923\\r\\n8.076923\\r\\n7.076923\\r\\n7.076923\\r\\n8.076923\\r\\n7.076923\\r\\n8.076923\\r\\n8.076923\\r\\n7.076923\\r\\n7.076923\\r\\n7.076923\\r\\n']}, {'input': '17 99\\r\\n13 13 12 13 11 12 12 12 13 13 11 13 13 13 13 12 13\\r\\n', 'output': ['5.294118\\r\\n5.294118\\r\\n6.294118\\r\\n5.294118\\r\\n7.294118\\r\\n6.294118\\r\\n6.294118\\r\\n6.294118\\r\\n5.294118\\r\\n5.294118\\r\\n7.294118\\r\\n5.294118\\r\\n5.294118\\r\\n5.294118\\r\\n5.294118\\r\\n6.294118\\r\\n5.294118\\r\\n']}, {'input': '9 91\\r\\n52 51 50 52 52 51 50 48 51\\r\\n', 'output': ['8.888889\\r\\n9.888889\\r\\n10.888889\\r\\n8.888889\\r\\n8.888889\\r\\n9.888889\\r\\n10.888889\\r\\n12.888889\\r\\n9.888889\\r\\n']}, {'input': '17 91\\r\\n13 13 13 13 12 12 13 13 12 13 12 13 10 12 13 13 12\\r\\n', 'output': ['4.823529\\r\\n4.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n5.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n4.823529\\r\\n5.823529\\r\\n4.823529\\r\\n7.823529\\r\\n5.823529\\r\\n4.823529\\r\\n4.823529\\r\\n5.823529\\r\\n']}, {'input': '2 3\\r\\n1 1\\r\\n', 'output': ['1.500000\\r\\n1.500000\\r\\n']}, {'input': '2 90\\r\\n0 89\\r\\n', 'output': ['89.500000\\r\\n0.500000\\r\\n']}, {'input': '4 17\\r\\n3 4 8 1\\r\\n', 'output': ['5.250000\\r\\n4.250000\\r\\n0.250000\\r\\n7.250000\\r\\n']}, {'input': '2 9\\r\\n5 5\\r\\n', 'output': ['4.500000\\r\\n4.500000\\r\\n']}, {'input': '7 28\\r\\n1 3 9 10 9 6 10\\r\\n', 'output': ['9.857143\\r\\n7.857143\\r\\n1.857143\\r\\n0.857143\\r\\n1.857143\\r\\n4.857143\\r\\n0.857143\\r\\n']}, {'input': '5 11\\r\\n1 2 3 4 5\\r\\n', 'output': ['4.200000\\r\\n3.200000\\r\\n2.200000\\r\\n1.200000\\r\\n0.200000\\r\\n']}, {'input': '2 1\\r\\n1 1\\r\\n', 'output': ['0.500000\\r\\n0.500000\\r\\n']}, {'input': '5 3\\r\\n1 1 1 1 1\\r\\n', 'output': ['0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n0.600000\\r\\n']}, {'input': '3 1\\r\\n100 100 100\\r\\n', 'output': ['0.333333\\r\\n0.333333\\r\\n0.333333\\r\\n']}, {'input': '5 50\\r\\n2 2 3 2 2\\r\\n', 'output': ['10.200000\\r\\n10.200000\\r\\n9.200000\\r\\n10.200000\\r\\n10.200000\\r\\n']}, {'input': '3 3\\r\\n2 2 3\\r\\n', 'output': ['1.333333\\r\\n1.333333\\r\\n0.333333\\r\\n']}, {'input': '2 52\\r\\n2 100\\r\\n', 'output': ['-1\\r\\n']}, {'input': '3 2\\r\\n2 2 3\\r\\n', 'output': ['1.000000\\r\\n1.000000\\r\\n0.000000\\r\\n']}, {'input': '5 1\\r\\n1 1 1 1 1\\r\\n', 'output': ['0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n0.200000\\r\\n']}, {'input': '2 4\\r\\n1 2\\r\\n', 'output': ['2.500000\\r\\n1.500000\\r\\n']}, {'input': '5 49\\r\\n1 2 3 4 5\\r\\n', 'output': ['11.800000\\r\\n10.800000\\r\\n9.800000\\r\\n8.800000\\r\\n7.800000\\r\\n']}]","id":192} {"description":"In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 and the finish on the tile number n. During the walk it is allowed to move from right to left between adjacent tiles in a row, and jump over a tile. More formally, if you are standing on the tile number i (i\u2009<\u2009n\u2009-\u20091), you can reach the tiles number i\u2009+\u20091 or the tile number i\u2009+\u20092 from it (if you stand on the tile number n\u2009-\u20091, you can only reach tile number n). We can assume that all the opposition movements occur instantaneously.In order to thwart an opposition rally, the Berland bloody regime organized the rain. The tiles on the boulevard are of poor quality and they are rapidly destroyed in the rain. We know that the i-th tile is destroyed after ai days of rain (on day ai tile isn't destroyed yet, and on day ai\u2009+\u20091 it is already destroyed). Of course, no one is allowed to walk on the destroyed tiles! So the walk of the opposition is considered thwarted, if either the tile number 1 is broken, or the tile number n is broken, or it is impossible to reach the tile number n from the tile number 1 if we can walk on undestroyed tiles.The opposition wants to gather more supporters for their walk. Therefore, the more time they have to pack, the better. Help the opposition to calculate how much time they still have and tell us for how many days the walk from the tile number 1 to the tile number n will be possible.","input_specification":"The first line contains integer n (1\u2009\u2264\u2009n\u2009\u2264\u2009103) \u2014 the boulevard's length in tiles. The second line contains n space-separated integers ai \u2014 the number of days after which the i-th tile gets destroyed (1\u2009\u2264\u2009ai\u2009\u2264\u2009103). ","output_specification":"Print a single number \u2014 the sought number of days.","notes":"NoteIn the first sample the second tile gets destroyed after day three, and the only path left is 1\u2009\u2192\u20093\u2009\u2192\u20094. After day five there is a two-tile gap between the first and the last tile, you can't jump over it.In the second sample path 1\u2009\u2192\u20093\u2009\u2192\u20095 is available up to day five, inclusive. On day six the last tile is destroyed and the walk is thwarted.","sample_inputs":["4\n10 3 5 10","5\n10 2 8 3 5"],"sample_outputs":["5","5"],"src_uid":"d526af933b5afe9abfdf9815e9664144","lang_cluster":"C","difficulty":1100,"human_solution":"#include\n#include\nint max(int a, int b)\n{\n\tif(a>b)\n\treturn a;\n\telse\n\treturn b;\n\n}\nint main()\n{\n\tint n,a[10004],i,min,max1;\n\tmin=1000000;\n\tscanf(\"%d\",&n);\n\tfor(i=0;ia[0])\n\tmin=a[0];\n\tif(min>a[n-1])\n\tmin=a[n-1];\n\tprintf(\"%d\",min);\n}","testcases":"[{'input': '4\\r\\n10 3 5 10\\r\\n', 'output': ['5\\r\\n']}, {'input': '5\\r\\n10 2 8 3 5\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n10 3 1 6 7 1 3 3 8 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n26 72 10 52 2 5 61 2 39 64\\r\\n', 'output': ['5\\r\\n']}, {'input': '100\\r\\n8 2 1 2 8 3 5 8 5 1 9 3 4 1 5 6 4 2 9 10 6 10 10 3 9 4 10 5 3 1 5 10 7 6 8 10 2 6 4 4 2 2 10 7 2 7 3 2 6 3 6 4 7 6 2 5 5 8 6 9 5 2 7 5 8 6 5 8 10 6 10 8 5 3 1 10 6 1 7 5 1 8 10 5 1 3 10 7 10 5 7 1 4 3 8 6 3 4 9 6\\r\\n', 'output': ['2\\r\\n']}, {'input': '100\\r\\n10 2 8 7 5 1 5 4 9 2 7 9 3 5 6 2 3 6 10 1 2 7 1 4 8 8 6 1 7 8 8 1 5 8 1 2 7 4 10 7 3 1 2 5 8 1 1 4 9 7 7 4 7 3 8 8 7 1 5 1 6 9 8 8 1 10 4 4 7 7 10 9 5 1 1 3 6 2 6 3 6 4 9 8 2 9 6 2 7 8 10 9 9 6 3 5 3 1 4 8\\r\\n', 'output': ['1\\r\\n']}, {'input': '100\\r\\n21 57 14 6 58 61 37 54 43 22 90 90 90 14 10 97 47 43 19 66 96 58 88 92 22 62 99 97 15 36 58 93 44 42 45 38 41 21 16 30 66 92 39 70 1 73 83 27 63 21 20 84 30 30 30 77 93 30 62 96 33 34 28 59 48 89 68 62 50 16 18 19 42 42 80 58 31 59 40 81 92 26 28 47 26 8 8 74 86 80 88 82 98 27 41 97 11 91 42 67\\r\\n', 'output': ['8\\r\\n']}, {'input': '100\\r\\n37 75 11 81 60 33 17 80 37 77 26 86 31 78 59 23 92 38 8 15 30 91 99 75 79 34 78 80 19 51 48 48 61 74 59 30 26 2 71 74 48 42 42 81 20 55 49 69 60 10 53 2 21 44 10 18 45 64 21 18 5 62 3 34 52 72 16 28 70 31 93 5 21 69 21 90 31 90 91 79 54 94 77 27 97 4 74 9 29 29 81 5 33 81 75 37 61 73 57 75\\r\\n', 'output': ['15\\r\\n']}, {'input': '100\\r\\n190 544 642 723 577 689 757 509 165 193 396 972 742 367 83 294 404 308 683 399 551 770 564 721 465 839 379 68 687 554 821 719 304 533 146 180 596 713 546 743 949 100 458 735 17 525 568 907 957 670 914 374 347 801 227 884 284 444 686 410 127 508 504 273 624 213 873 658 336 79 819 938 3 722 649 368 733 747 577 746 940 308 970 963 145 487 102 559 790 243 609 77 552 565 151 492 726 448 393 837\\r\\n', 'output': ['180\\r\\n']}, {'input': '100\\r\\n606 358 399 589 724 454 741 183 571 244 984 867 828 232 189 821 642 855 220 839 585 203 135 305 970 503 362 658 491 562 706 62 721 465 560 880 833 646 365 23 679 549 317 834 583 947 134 253 250 768 343 996 541 163 355 925 336 874 997 632 498 529 932 487 415 391 766 224 364 790 486 512 183 458 343 751 633 126 688 536 845 380 423 447 904 779 520 843 977 392 406 147 888 520 886 179 176 129 8 750\\r\\n', 'output': ['129\\r\\n']}, {'input': '5\\r\\n3 2 3 4 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n4 8 9 10 6\\r\\n', 'output': ['4\\r\\n']}, {'input': '5\\r\\n2 21 6 5 9\\r\\n', 'output': ['2\\r\\n']}, {'input': '5\\r\\n34 39 30 37 35\\r\\n', 'output': ['34\\r\\n']}, {'input': '5\\r\\n14 67 15 28 21\\r\\n', 'output': ['14\\r\\n']}, {'input': '5\\r\\n243 238 138 146 140\\r\\n', 'output': ['140\\r\\n']}, {'input': '5\\r\\n46 123 210 119 195\\r\\n', 'output': ['46\\r\\n']}, {'input': '5\\r\\n725 444 477 661 761\\r\\n', 'output': ['477\\r\\n']}, {'input': '10\\r\\n2 2 3 4 4 1 5 3 1 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n1 10 1 10 1 1 7 8 6 7\\r\\n', 'output': ['1\\r\\n']}, {'input': '10\\r\\n5 17 8 1 10 20 9 18 12 20\\r\\n', 'output': ['5\\r\\n']}, {'input': '10\\r\\n18 11 23 7 9 10 28 29 46 21\\r\\n', 'output': ['9\\r\\n']}, {'input': '10\\r\\n2 17 53 94 95 57 36 47 68 48\\r\\n', 'output': ['2\\r\\n']}, {'input': '10\\r\\n93 231 176 168 177 222 22 137 110 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '10\\r\\n499 173 45 141 425 276 96 290 428 95\\r\\n', 'output': ['95\\r\\n']}, {'input': '10\\r\\n201 186 897 279 703 376 238 93 253 316\\r\\n', 'output': ['201\\r\\n']}, {'input': '25\\r\\n3 2 3 2 2 2 3 4 5 1 1 4 1 2 1 3 5 5 3 5 1 2 4 1 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '25\\r\\n9 9 1 9 10 5 6 4 6 1 5 2 2 1 2 8 4 6 5 7 1 10 5 4 9\\r\\n', 'output': ['2\\r\\n']}, {'input': '25\\r\\n2 17 21 4 13 6 14 18 17 1 16 13 24 4 12 7 8 16 9 25 25 9 11 20 18\\r\\n', 'output': ['2\\r\\n']}, {'input': '25\\r\\n38 30 9 35 33 48 8 4 49 2 39 19 34 35 47 49 33 4 23 5 42 35 49 11 30\\r\\n', 'output': ['8\\r\\n']}, {'input': '25\\r\\n75 34 77 68 60 38 76 89 35 68 28 36 96 63 43 12 9 4 37 75 88 30 11 58 35\\r\\n', 'output': ['9\\r\\n']}, {'input': '25\\r\\n108 3 144 140 239 105 59 126 224 181 147 102 94 201 68 121 167 94 60 130 64 162 45 95 235\\r\\n', 'output': ['94\\r\\n']}, {'input': '25\\r\\n220 93 216 467 134 408 132 220 292 11 363 404 282 253 141 313 310 356 214 256 380 81 42 128 363\\r\\n', 'output': ['81\\r\\n']}, {'input': '25\\r\\n371 884 75 465 891 510 471 52 382 829 514 610 660 642 179 108 41 818 346 106 738 993 706 574 623\\r\\n', 'output': ['108\\r\\n']}, {'input': '50\\r\\n1 2 1 3 2 5 2 2 2 3 4 4 4 3 3 4 1 2 3 1 5 4 1 2 2 1 5 3 2 2 1 5 4 5 2 5 4 1 1 3 5 2 1 4 5 5 1 5 5 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n2 4 9 8 1 3 7 1 2 3 8 9 8 8 5 2 10 5 8 1 3 1 8 2 3 7 9 10 2 9 9 7 3 8 6 10 6 5 4 8 1 1 5 6 8 9 5 9 5 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '50\\r\\n22 9 5 3 24 21 25 13 17 21 14 8 22 18 2 3 22 9 10 11 25 22 5 10 16 7 15 3 2 13 2 12 9 24 3 14 2 18 3 22 8 2 19 6 16 4 5 20 10 12\\r\\n', 'output': ['3\\r\\n']}, {'input': '50\\r\\n14 4 20 37 50 46 19 20 25 47 10 6 34 12 41 47 9 22 28 41 34 47 40 12 42 9 4 15 15 27 8 38 9 4 17 8 13 47 7 9 38 30 48 50 7 41 34 23 11 16\\r\\n', 'output': ['9\\r\\n']}, {'input': '50\\r\\n69 9 97 15 22 69 27 7 23 84 73 74 60 94 43 98 13 4 63 49 7 31 93 23 6 75 32 63 49 32 99 43 68 48 16 54 20 38 40 65 34 28 21 55 79 50 2 18 22 95\\r\\n', 'output': ['13\\r\\n']}, {'input': '50\\r\\n50 122 117 195 42 178 153 194 7 89 142 40 158 230 213 104 179 56 244 196 85 159 167 19 157 20 230 201 152 98 250 242 10 52 96 242 139 181 90 107 178 52 196 79 23 61 212 47 97 97\\r\\n', 'output': ['50\\r\\n']}, {'input': '50\\r\\n354 268 292 215 187 232 35 38 179 79 108 491 346 384 345 103 14 260 148 322 459 238 220 493 374 237 474 148 21 221 88 377 289 121 201 198 490 117 382 454 359 390 346 456 294 325 130 306 484 83\\r\\n', 'output': ['38\\r\\n']}, {'input': '50\\r\\n94 634 27 328 629 967 728 177 379 908 801 715 787 192 427 48 559 923 841 6 759 335 251 172 193 593 456 780 647 638 750 881 206 129 278 744 91 49 523 248 286 549 593 451 216 753 471 325 870 16\\r\\n', 'output': ['16\\r\\n']}, {'input': '100\\r\\n5 5 4 3 5 1 2 5 1 1 3 5 4 4 1 1 1 1 5 4 4 5 1 5 5 1 2 1 3 1 5 1 3 3 3 2 2 2 1 1 5 1 3 4 1 1 3 2 5 2 2 5 5 4 4 1 3 4 3 3 4 5 3 3 3 1 2 1 4 2 4 4 1 5 1 3 5 5 5 5 3 4 4 3 1 2 5 2 3 5 4 2 4 5 3 2 4 2 4 3\\r\\n', 'output': ['1\\r\\n']}, {'input': '100\\r\\n3 4 8 10 8 6 4 3 7 7 6 2 3 1 3 10 1 7 9 3 5 5 2 6 2 9 1 7 4 2 4 1 6 1 7 10 2 5 3 7 6 4 6 2 8 8 8 6 6 10 3 7 4 3 4 1 7 9 3 6 3 6 1 4 9 3 8 1 10 1 4 10 7 7 9 5 3 8 10 2 1 10 8 7 10 8 5 3 1 2 1 10 6 1 5 3 3 5 7 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '100\\r\\n14 7 6 21 12 5 22 23 2 9 8 1 9 2 20 2 24 7 14 24 8 19 15 19 10 24 9 4 21 12 3 21 9 16 9 22 18 4 17 19 19 9 6 1 13 15 23 3 14 3 7 15 17 10 7 24 4 18 21 14 25 20 19 19 14 25 24 21 16 10 2 16 1 21 1 24 13 7 13 20 12 20 2 16 3 6 6 2 19 9 16 4 1 2 7 18 15 14 10 22\\r\\n', 'output': ['2\\r\\n']}, {'input': '100\\r\\n2 46 4 6 38 19 15 34 10 35 37 30 3 25 5 45 40 45 33 31 6 20 10 44 11 9 2 14 35 5 9 23 20 2 48 22 25 35 38 31 24 33 35 16 4 30 27 10 12 22 6 24 12 30 23 21 14 12 32 21 7 12 25 43 18 34 34 28 47 13 28 43 18 39 44 42 35 26 35 14 8 29 32 20 29 3 20 6 20 9 9 27 8 42 10 37 42 27 8 1\\r\\n', 'output': ['1\\r\\n']}, {'input': '100\\r\\n85 50 17 89 65 89 5 20 86 26 16 21 85 14 44 31 87 31 6 2 48 67 8 80 79 1 48 36 97 1 5 30 79 50 78 12 2 55 76 100 54 40 26 81 97 96 68 56 87 14 51 17 54 37 52 33 69 62 38 63 74 15 62 78 9 19 67 2 60 58 93 60 18 96 55 48 34 7 79 82 32 58 90 67 20 50 27 15 7 89 98 10 11 15 99 49 4 51 77 52\\r\\n', 'output': ['5\\r\\n']}, {'input': '100\\r\\n26 171 37 63 189 202 180 210 179 131 43 33 227 5 211 130 105 23 229 48 174 48 182 68 174 146 200 166 246 116 106 86 72 206 216 207 70 148 83 149 94 64 142 8 241 211 27 190 58 116 113 96 210 237 73 240 180 110 34 115 167 4 42 30 162 114 74 131 34 206 174 168 216 101 216 149 212 172 180 220 123 201 25 116 42 143 105 40 30 123 174 220 57 238 145 222 105 184 131 162\\r\\n', 'output': ['26\\r\\n']}, {'input': '100\\r\\n182 9 8 332 494 108 117 203 43 473 451 426 119 408 342 84 88 35 383 84 48 69 31 54 347 363 342 69 422 489 194 16 55 171 71 355 116 142 181 246 275 402 155 282 160 179 240 448 49 101 42 499 434 258 21 327 95 376 38 422 68 381 170 372 427 149 38 48 400 224 246 438 62 43 280 40 108 385 351 379 224 311 66 125 300 41 372 358 5 221 223 341 201 261 455 165 74 379 214 10\\r\\n', 'output': ['9\\r\\n']}, {'input': '100\\r\\n836 969 196 706 812 64 743 262 667 27 227 730 50 510 374 915 124 527 778 528 175 151 439 994 835 87 197 91 121 243 534 634 4 410 936 6 979 227 745 734 492 792 209 95 602 446 299 533 376 595 971 879 36 126 528 759 116 499 571 664 787 820 870 838 604 240 334 872 477 415 57 689 870 690 304 122 487 191 253 610 301 348 358 806 828 911 8 320 414 172 268 867 978 205 812 60 845 395 406 155\\r\\n', 'output': ['121\\r\\n']}, {'input': '250\\r\\n5 3 5 1 3 5 3 4 4 3 1 5 2 2 1 1 5 2 3 3 2 5 4 3 2 4 2 3 5 4 1 2 3 5 2 2 5 4 1 3 3 5 4 4 4 4 4 2 4 2 3 5 1 4 3 3 2 3 5 3 3 4 4 2 3 1 3 4 1 4 5 4 1 2 3 4 1 5 3 3 2 3 5 4 2 5 2 2 3 5 4 3 5 4 2 1 4 1 4 1 1 3 5 1 1 2 1 3 4 5 4 3 2 5 1 3 5 1 1 3 3 5 1 4 5 1 2 1 1 5 5 3 5 1 4 1 4 4 4 4 4 1 4 3 4 5 4 1 2 2 5 2 2 4 2 3 5 3 5 5 3 3 2 2 2 1 1 4 4 4 2 1 4 5 3 1 5 4 4 5 5 5 3 3 5 2 1 4 5 4 1 1 1 5 3 5 2 3 3 2 1 3 4 1 4 1 5 3 1 2 5 5 2 1 4 4 2 3 5 2 4 1 3 4 5 5 4 3 2 2 3 2 4 2 5 3 5 5 1 5 3 2 2 4 2 5 5 5 2 5\\r\\n', 'output': ['1\\r\\n']}, {'input': '1\\r\\n987\\r\\n', 'output': ['987\\r\\n']}, {'input': '1\\r\\n1\\r\\n', 'output': ['1\\r\\n']}, {'input': '2\\r\\n1 2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n2 5 5 5 5\\r\\n', 'output': ['2\\r\\n']}, {'input': '1\\r\\n500\\r\\n', 'output': ['500\\r\\n']}]","id":193} {"description":"The Little Elephant very much loves sums on intervals.This time he has a pair of integers l and r (l\u2009\u2264\u2009r). The Little Elephant has to find the number of such integers x (l\u2009\u2264\u2009x\u2009\u2264\u2009r), that the first digit of integer x equals the last one (in decimal notation). For example, such numbers as 101, 477474 or 9 will be included in the answer and 47, 253 or 1020 will not.Help him and count the number of described numbers x for a given pair l and r.","input_specification":"The single line contains a pair of integers l and r (1\u2009\u2264\u2009l\u2009\u2264\u2009r\u2009\u2264\u20091018) \u2014 the boundaries of the interval. Please, do not use the %lld specifier to read or write 64-bit integers in \u0421++. It is preferred to use cin, cout streams or the %I64d specifier.","output_specification":"On a single line print a single integer \u2014 the answer to the problem.","notes":"NoteIn the first sample the answer includes integers 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44. ","sample_inputs":["2 47","47 1024"],"sample_outputs":["12","98"],"src_uid":"9642368dc4ffe2fc6fe6438c7406c1bd","lang_cluster":"C","difficulty":1500,"human_solution":"#include\nlong long d[20];\nvoid compute()\n{\n d[0]=9;\n d[1]=18;\n long long s=10,i;\n for(i=2;i<20;++i)\n {\n d[i]=9*s+d[i-1];\n s*=10;\n }\n}\nlong long find(long long x)\n{\n if(x<10)\n return x;\n long long ans=0;\n ans=x\/10+9;\n return ans;\n}\nint main()\n{\n long long l,r,x,ans=0,rem;\n scanf(\"%lld%lld\",&l,&r);\n x=r;\n rem=x%10;\n while(x>=10)\n x\/=10;\n if(x>rem)\n ans-=1;\n x=l-1;\n rem=(l-1)%10;\n while(x>=10)\n x\/=10;\n if(x>rem)\n ans+=1;\n compute();\n ans-=find(l-1);\n ans+=find(r);\n printf(\"%lld\",ans);\n return 0;\n}\n","testcases":"[{'input': '2 47\\r\\n', 'output': ['12']}, {'input': '47 1024\\r\\n', 'output': ['98']}, {'input': '1 1000\\r\\n', 'output': ['108']}, {'input': '1 10000\\r\\n', 'output': ['1008']}, {'input': '47 8545\\r\\n', 'output': ['849']}, {'input': '1000 1000\\r\\n', 'output': ['0']}, {'input': '47547 4587554587754542\\r\\n', 'output': ['458755458770699']}, {'input': '1 1000000\\r\\n', 'output': ['100008']}, {'input': '47 74\\r\\n', 'output': ['2']}, {'input': '10001 10000002\\r\\n', 'output': ['999001']}, {'input': '10000 100000\\r\\n', 'output': ['9000']}, {'input': '458754 4588754\\r\\n', 'output': ['413001']}, {'input': '111 111\\r\\n', 'output': ['1']}, {'input': '110 147\\r\\n', 'output': ['4']}, {'input': '1 1000000000\\r\\n', 'output': ['100000008']}, {'input': '12 10000000000\\r\\n', 'output': ['999999998']}, {'input': '1000000000 1000000000\\r\\n', 'output': ['0']}, {'input': '1 1000000000000000000\\r\\n', 'output': ['100000000000000008']}, {'input': '11 111111111111111100\\r\\n', 'output': ['11111111111111109']}, {'input': '100000000000000000 1000000000000000000\\r\\n', 'output': ['90000000000000000']}, {'input': '45481484484 848469844684844\\r\\n', 'output': ['84842436320036']}, {'input': '975400104587000 48754000000000001\\r\\n', 'output': ['4777859989541300']}, {'input': '11220451511 51511665251233335\\r\\n', 'output': ['5151165403078183']}, {'input': '77 77\\r\\n', 'output': ['1']}, {'input': '99 102\\r\\n', 'output': ['2']}, {'input': '9997 87878000008\\r\\n', 'output': ['8787799002']}, {'input': '10000000001 111111111111100001\\r\\n', 'output': ['11111110111110001']}, {'input': '7777 88888\\r\\n', 'output': ['8112']}, {'input': '999999999 10000000000\\r\\n', 'output': ['900000001']}, {'input': '235 236\\r\\n', 'output': ['0']}, {'input': '1 1\\r\\n', 'output': ['1']}, {'input': '2 2\\r\\n', 'output': ['1']}, {'input': '1 2\\r\\n', 'output': ['2']}, {'input': '4 7\\r\\n', 'output': ['4']}, {'input': '7 10\\r\\n', 'output': ['3']}, {'input': '1 11\\r\\n', 'output': ['10']}, {'input': '1 10\\r\\n', 'output': ['9']}, {'input': '7 8\\r\\n', 'output': ['2']}, {'input': '88 990\\r\\n', 'output': ['91']}, {'input': '458985985498001244 985458425544874008\\r\\n', 'output': ['52647244004687276']}, {'input': '115998725487587451 245744899758754501\\r\\n', 'output': ['12974617427116705']}, {'input': '595754249475458004 615044544745124547\\r\\n', 'output': ['1929029526966655']}, {'input': '9754875457700 1000000000000000000\\r\\n', 'output': ['99999024512454230']}, {'input': '8758754570000 999999999999999999\\r\\n', 'output': ['99999124124543000']}, {'input': '111111111111111111 333333333444444445\\r\\n', 'output': ['22222222233333334']}, {'input': '822981258385599125 841978899930248528\\r\\n', 'output': ['1899764154464941']}, {'input': '779547115376367013 980561039207670775\\r\\n', 'output': ['20101392383130376']}, {'input': '335408916782916802 416495628489807285\\r\\n', 'output': ['8108671170689049']}, {'input': '252509053898415172 285803555062529649\\r\\n', 'output': ['3329450116411448']}, {'input': '919845424847912645 970651082117950285\\r\\n', 'output': ['5080565727003764']}, {'input': '522842183413115088 853628713003942530\\r\\n', 'output': ['33078652959082744']}, {'input': '84324827171274023 607953653548585226\\r\\n', 'output': ['52362882637731121']}, {'input': '1312148742261681 277460340506883334\\r\\n', 'output': ['27614819176462166']}, {'input': '645762257531682046 885295120956158518\\r\\n', 'output': ['23953286342447648']}, {'input': '819875140559301752 946247219812473271\\r\\n', 'output': ['12637207925317152']}, {'input': '4 19\\r\\n', 'output': ['7']}, {'input': '5 45\\r\\n', 'output': ['9']}, {'input': '9999999999999987 99999999999999711\\r\\n', 'output': ['8999999999999973']}, {'input': '2 3\\r\\n', 'output': ['2']}, {'input': '1827171 232817181719384635\\r\\n', 'output': ['23281718171755747']}, {'input': '999999999999999999 1000000000000000000\\r\\n', 'output': ['1']}, {'input': '73 678\\r\\n', 'output': ['61']}]","id":194} {"description":"Vasya, like many others, likes to participate in a variety of sweepstakes and lotteries. Now he collects wrappings from a famous chocolate bar \"Jupiter\". According to the sweepstake rules, each wrapping has an integer written on it \u2014 the number of points that the participant adds to his score as he buys the bar. After a participant earns a certain number of points, he can come to the prize distribution center and exchange the points for prizes. When somebody takes a prize, the prize's cost is simply subtracted from the number of his points.Vasya didn't only bought the bars, he also kept a record of how many points each wrapping cost. Also, he remembers that he always stucks to the greedy strategy \u2014 as soon as he could take at least one prize, he went to the prize distribution centre and exchanged the points for prizes. Moreover, if he could choose between multiple prizes, he chose the most expensive one. If after an exchange Vasya had enough points left to get at least one more prize, then he continued to exchange points.The sweepstake has the following prizes (the prizes are sorted by increasing of their cost): a mug (costs a points), a towel (costs b points), a bag (costs c points), a bicycle (costs d points), a car (costs e points). Now Vasya wants to recollect what prizes he has received. You know sequence p1,\u2009p2,\u2009...,\u2009pn, where pi is the number of points Vasya got for the i-th bar. The sequence of points is given in the chronological order. You also know numbers a, b, c, d, e. Your task is to find, how many prizes Vasya received, what prizes they are and how many points he's got left after all operations are completed.","input_specification":"The first line contains a single integer n (1\u2009\u2264\u2009n\u2009\u2264\u200950) \u2014 the number of chocolate bar wrappings that brought points to Vasya. The second line contains space-separated integers p1,\u2009p2,\u2009...,\u2009pn (1\u2009\u2264\u2009pi\u2009\u2264\u2009109). The third line contains 5 integers a, b, c, d, e (1\u2009\u2264\u2009a\u2009<\u2009b\u2009<\u2009c\u2009<\u2009d\u2009<\u2009e\u2009\u2264\u2009109) \u2014 the prizes' costs.","output_specification":"Print on the first line 5 integers, separated by a space \u2014 the number of mugs, towels, bags, bicycles and cars that Vasya has got, respectively. On the second line print a single integer \u2014 the number of points Vasya will have left after all operations of exchange are completed. Please, do not use the %lld specifier to read or write 64-bit integers in \u0421++. It is preferred to use the cin, cout streams or the %I64d specifier.","notes":"NoteIn the first sample Vasya gets 3 points after eating the first chocolate bar. Then he exchanges 2 points and gets a mug. Vasya wins a bag after eating the second chocolate bar. Then he wins a towel after eating the third chocolate bar. After all chocolate bars 3\u2009-\u20092\u2009+\u200910\u2009-\u200910\u2009+\u20094\u2009-\u20094\u2009=\u20091 points remains.","sample_inputs":["3\n3 10 4\n2 4 10 15 20","4\n10 4 39 2\n3 5 10 11 12"],"sample_outputs":["1 1 1 0 0 \n1","3 0 1 0 3 \n0"],"src_uid":"1ae2942b72ebb7c55359c41e141900d7","lang_cluster":"C","difficulty":1200,"human_solution":"#include\nlong long int n,s,j,i,h[6000],t,a[5],b[5];\nint main()\n{\n\tscanf(\"%lld\",&n);\n\tfor(i=0;i-1;j--)\n\t\t{\n\t\t\tif(t>=a[j]) \n\t\t\t{s=t\/a[j];t-=a[j]*s;b[j]+=s;}\n\t\t}\n\t}\n\tfor(i=0;i<5;i++) printf(\"%lld \",b[i]);printf(\"\\n%lld\",t);\n\treturn 0;\n}\n","testcases":"[{'input': '3\\r\\n3 10 4\\r\\n2 4 10 15 20\\r\\n', 'output': ['1 1 1 0 0 \\r\\n1\\r\\n']}, {'input': '4\\r\\n10 4 39 2\\r\\n3 5 10 11 12\\r\\n', 'output': ['3 0 1 0 3 \\r\\n0\\r\\n']}, {'input': '1\\r\\n45\\r\\n1 2 3 4 5\\r\\n', 'output': ['0 0 0 0 9 \\r\\n0\\r\\n']}, {'input': '1\\r\\n50\\r\\n1 2 4 5 6\\r\\n', 'output': ['0 1 0 0 8 \\r\\n0\\r\\n']}, {'input': '1\\r\\n6\\r\\n1 2 4 6 7\\r\\n', 'output': ['0 0 0 1 0 \\r\\n0\\r\\n']}, {'input': '1\\r\\n11\\r\\n1 2 3 6 8\\r\\n', 'output': ['0 0 1 0 1 \\r\\n0\\r\\n']}, {'input': '45\\r\\n54672703 354223499 798425228 192616902 934526477 130046515 120969797 1128116 221465324 487958664 211577865 653388287 538234 467693667 387627267 811104156 26715905 108515494 288069433 106690737 712686358 683861047 56548860 385125409 178325602 329144983 320699771 611743158 176982141 882718242 574909811 18981354 497482742 126502373 342328066 970474066 352019823 333022487 625437081 18635432 354739941 509867062 781623566 885791347 684953358\\r\\n1 2 3 4 5\\r\\n', 'output': ['10 15 9 7 3554511651 \\r\\n0\\r\\n']}, {'input': '5\\r\\n43 4 16 36 41\\r\\n5 6 7 8 9\\r\\n', 'output': ['0 0 2 0 14 \\r\\n0\\r\\n']}, {'input': '5\\r\\n6 6 47 32 28\\r\\n1 2 6 9 11\\r\\n', 'output': ['2 1 3 1 8 \\r\\n0\\r\\n']}, {'input': '5\\r\\n30 25 31 47 40\\r\\n1 3 6 13 20\\r\\n', 'output': ['6 3 3 0 7 \\r\\n0\\r\\n']}, {'input': '10\\r\\n588141495 24894836 162095938 610922780 767639361 522148294 556163403 302924834 618125209 410537083\\r\\n1 2 3 4 5\\r\\n', 'output': ['2 0 3 3 912718642 \\r\\n0\\r\\n']}, {'input': '10\\r\\n5 37 8 21 10 13 36 4 40 26\\r\\n3 5 6 7 10\\r\\n', 'output': ['1 2 1 3 16 \\r\\n0\\r\\n']}, {'input': '10\\r\\n3 25 17 20 25 26 15 35 47 16\\r\\n5 8 11 14 15\\r\\n', 'output': ['1 1 3 0 12 \\r\\n3\\r\\n']}, {'input': '10\\r\\n1 10 34 9 49 42 45 8 42 7\\r\\n2 6 11 13 14\\r\\n', 'output': ['5 5 1 0 14 \\r\\n0\\r\\n']}, {'input': '15\\r\\n13 44 13 13 38 25 43 25 40 28 5 23 25 41 6\\r\\n1 2 3 4 5\\r\\n', 'output': ['2 0 7 1 71 \\r\\n0\\r\\n']}, {'input': '15\\r\\n195995511 767544072 924890005 342377584 638748004 904551320 222776859 921356712 204326392 225923474 90658415 610365756 971907038 41090763 853207872\\r\\n5 7 8 9 10\\r\\n', 'output': ['3 0 3 2 791571972 \\r\\n0\\r\\n']}, {'input': '15\\r\\n14 19 5 16 11 22 40 7 13 21 24 26 49 22 26\\r\\n1 2 7 8 9\\r\\n', 'output': ['4 19 2 2 27 \\r\\n0\\r\\n']}, {'input': '15\\r\\n5 41 46 48 22 49 5 37 10 4 19 2 16 32 24\\r\\n2 11 15 18 20\\r\\n', 'output': ['30 1 2 1 12 \\r\\n1\\r\\n']}, {'input': '15\\r\\n50 12 36 11 38 28 4 11 29 34 22 46 43 2 29\\r\\n7 8 10 17 23\\r\\n', 'output': ['1 0 6 3 12 \\r\\n1\\r\\n']}, {'input': '15\\r\\n676837988 94471701 777591167 399710490 409807125 414445437 8315750 102835211 36239666 141260442 589733329 572072035 789807197 431009789 123234386\\r\\n20 39 45 46 48\\r\\n', 'output': ['5 2 1 0 115986906 \\r\\n2\\r\\n']}, {'input': '25\\r\\n26 29 17 11 35 21 11 22 17 24 41 44 27 34 42 24 44 3 8 25 23 6 16 41 2\\r\\n1 2 3 4 5\\r\\n', 'output': ['8 6 3 6 108 \\r\\n0\\r\\n']}, {'input': '25\\r\\n46 37 12 28 16 9 26 12 31 49 28 23 39 49 21 40 1 31 8 6 33 46 4 12 20\\r\\n5 6 7 8 10\\r\\n', 'output': ['1 2 2 3 57 \\r\\n2\\r\\n']}, {'input': '25\\r\\n48 3 22 29 40 21 28 31 22 16 17 3 47 37 38 15 16 27 41 48 17 11 22 15 15\\r\\n10 11 12 13 15\\r\\n', 'output': ['1 1 1 2 38 \\r\\n0\\r\\n']}, {'input': '49\\r\\n150841996 278751430 236103841 373294104 702072537 197872718 286517088 985323686 816421587 49928785 500114241 47334350 280942286 86728792 606895563 70696090 770589765 492645787 250574857 747511645 224488546 90659419 587972065 281798558 133719196 726362846 487266436 311413921 795767163 779792904 646907905 87907470 461431159 273590163 584894453 408543297 215247358 47704043 300890973 570589101 134168725 904691113 260042124 834209517 554685974 348043433 100083255 966828009 508031511\\r\\n1 2 3 4 5\\r\\n', 'output': ['12 7 12 7 4111778339 \\r\\n0\\r\\n']}, {'input': '25\\r\\n43 34 26 43 11 13 34 8 6 25 39 41 21 34 27 12 11 1 36 45 47 12 18 43 38\\r\\n1 2 10 24 25\\r\\n', 'output': ['11 46 19 0 15 \\r\\n0\\r\\n']}, {'input': '25\\r\\n38 30 40 7 7 18 43 5 29 49 50 9 4 18 30 35 21 22 15 33 9 31 32 22 6\\r\\n2 14 15 40 48\\r\\n', 'output': ['48 0 22 2 2 \\r\\n1\\r\\n']}, {'input': '50\\r\\n667406402 354775600 95220950 604569294 945922983 82947113 120853697 25192357 911801905 8804755 572528228 687361070 180664274 949243037 5283222 74969288 23627567 882714363 413386071 937062768 916521072 864701923 328941225 17876118 770879655 928962609 331124489 236187404 878629850 202558122 227732104 296494363 555832750 391788125 553472395 587090096 991781042 382982437 764518939 870576820 596491334 48319052 813976810 545209721 619789095 955839818 282149347 476620368 134986392 655856299\\r\\n1 2 3 4 5\\r\\n', 'output': ['3 13 11 9 4954444924 \\r\\n0\\r\\n']}, {'input': '50\\r\\n7 33 16 27 6 26 21 46 28 43 34 28 44 21 40 32 47 47 29 22 25 18 31 18 37 3 47 43 37 25 33 10 29 43 44 33 45 14 43 5 27 25 35 20 9 13 49 9 21 26\\r\\n3 4 5 7 9\\r\\n', 'output': ['4 6 6 15 138 \\r\\n1\\r\\n']}, {'input': '45\\r\\n18 21 6 3 48 23 5 26 37 6 49 6 42 19 8 39 38 47 36 22 13 21 14 32 43 42 5 30 35 36 16 34 32 8 1 37 14 29 39 50 25 26 10 25 39\\r\\n1 6 7 8 14\\r\\n', 'output': ['77 5 4 19 62 \\r\\n0\\r\\n']}, {'input': '45\\r\\n28 28 3 4 7 34 44 2 8 7 20 29 27 49 20 33 11 31 47 38 41 40 11 16 5 20 12 47 49 25 25 6 40 3 2 3 32 38 34 21 28 48 12 39 43\\r\\n9 10 12 14 20\\r\\n', 'output': ['4 5 2 8 44 \\r\\n8\\r\\n']}, {'input': '50\\r\\n17 30 29 29 50 42 15 18 34 10 30 3 44 11 4 35 42 8 14 41 30 4 11 1 3 23 7 28 35 6 24 37 6 12 8 7 36 40 41 26 13 46 15 40 32 34 15 28 46 31\\r\\n20 24 40 46 50\\r\\n', 'output': ['4 11 9 5 5 \\r\\n7\\r\\n']}]","id":195} {"description":"Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.We know that the i-th star on the pedal axle has ai (0\u2009<\u2009a1\u2009<\u2009a2\u2009<\u2009...\u2009<\u2009an) teeth, and the j-th star on the rear wheel axle has bj (0\u2009<\u2009b1\u2009<\u2009b2\u2009<\u2009...\u2009<\u2009bm) teeth. Any pair (i,\u2009j) (1\u2009\u2264\u2009i\u2009\u2264\u2009n;\u00a01\u2009\u2264\u2009j\u2009\u2264\u2009m) is called a gear and sets the indexes of stars to which the chain is currently attached. Gear (i,\u2009j) has a gear ratio, equal to the value .Since Vasya likes integers, he wants to find such gears (i,\u2009j), that their ratios are integers. On the other hand, Vasya likes fast driving, so among all \"integer\" gears (i,\u2009j) he wants to choose a gear with the maximum ratio. Help him to find the number of such gears.In the problem, fraction denotes division in real numbers, that is, no rounding is performed.","input_specification":"The first input line contains integer n (1\u2009\u2264\u2009n\u2009\u2264\u200950) \u2014 the number of stars on the bicycle's pedal axle. The second line contains n integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u2009104) in the order of strict increasing. The third input line contains integer m (1\u2009\u2264\u2009m\u2009\u2264\u200950) \u2014 the number of stars on the rear wheel axle. The fourth line contains m integers b1,\u2009b2,\u2009...,\u2009bm (1\u2009\u2264\u2009bi\u2009\u2264\u2009104) in the order of strict increasing. It is guaranteed that there exists at least one gear (i,\u2009j), that its gear ratio is an integer. The numbers on the lines are separated by spaces.","output_specification":"Print the number of \"integer\" gears with the maximum ratio among all \"integer\" gears.","notes":"NoteIn the first sample the maximum \"integer\" gear ratio equals 3. There are two gears that have such gear ratio. For one of them a1\u2009=\u20094,\u2009b1\u2009=\u200912, and for the other a2\u2009=\u20095,\u2009b3\u2009=\u200915.","sample_inputs":["2\n4 5\n3\n12 13 15","4\n1 2 3 4\n5\n10 11 12 13 14"],"sample_outputs":["2","1"],"src_uid":"102667eaa3aee012fef70f4192464674","lang_cluster":"C","difficulty":900,"human_solution":"#include\n\nint main(void)\n{\t\n\tfloat k;\n\tint a[50],b[50],s,t,p=0,n,m,i,j,c[500];\n\tscanf(\"%d\",&n);\n\tfor(i=0;ic[j])\n\t\t\t\t{\n\t\t\t\t\ts=c[i];\n\t\t\t\t\tc[i]=c[j];\n\t\t\t\t\tc[j]=s;\n\t\t\t\t}\n\t\t\t}\n\t}\n\tfor(j=0,t=0;j\n#include \n \n \nint main(){\n char sequance[100003];\n scanf(\"%s\", sequance);\n char a[103];\n char b[103];\n int n1=0;\n int n2=0;\n int n3=0;\n int n4=0;\n scanf(\"%s\", a);\n scanf(\"%s\", b);\n int current=0;\n int current2=0;\n int lenseq=strlen(sequance);\n int lena=strlen(a);\n int lenb=strlen(b);\n\/\/ if (sequance[1000]=='a'){\n \n\/\/ printf(\"%d lenseq\\n\", lenseq);\n\/\/ printf(\"%d lena\\n\", lena);\n\/\/ printf(\"%d lenb\\n\", lenb);\n\/\/ }\n for (int j=0;j<=lenseq-lena;j++){\n if (sequance[j]==a[0]) {\n n1=1;\n for (int i=1;i=lena-1; j--){\n if (sequance[j]==a[0]) {\n n3=1;\n for (int i=1;i=0; j--){\n if (sequance[j]==b[0]) {\n n4=1;\n for (int i=1;ilenseq) {\n printf(\"fantasy\");\n }\n else if ( (n1==lena && n2==lenb) && (n3!=lena || n4!=lenb )) {\n printf(\"forward\");\n }\n else if ( (n1!=lena || n2!=lenb) && (n3==lena && n4==lenb )) {\n printf(\"backward\");\n }\n else if ( (n1==lena || n2==lenb) && (n3==lena && n4==lenb )) {\n printf(\"both\");\n }\n}","testcases":"[{'input': 'atob\\r\\na\\r\\nb\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'aaacaaa\\r\\naca\\r\\naa\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aaa\\r\\naa\\r\\naa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'astalavista\\r\\nastla\\r\\nlavista\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'abacabadabacaba\\r\\nabacaba\\r\\nabacaba\\r\\n', 'output': ['both\\r\\n']}, {'input': 'a\\r\\na\\r\\na\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'ab\\r\\nb\\r\\na\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'aaa\\r\\naaaa\\r\\naaaa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'bbabbbbababbaabaabaa\\r\\nabb\\r\\nbaab\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'bbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbb\\r\\nbbbbb\\r\\n', 'output': ['both\\r\\n']}, {'input': 'babaabababaaaababaabababaabababababababbababbbabbaabababaababbaabbababaababaaabababaabbaababaaababaa\\r\\nabaabababaa\\r\\nabaabbaa\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'bbbbbbbbbbbbbbbbbbbbbbbbb\\r\\nbbbb\\r\\nbbbbb\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aababaaababaabbaabababaaababaabababbaabbabaabababaabbabbbababbababababababaabababaababaaaabababaabab\\r\\nabaabababaa\\r\\nabaabbaa\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'aaaa\\r\\naaa\\r\\naa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzz\\r\\nzzz\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzzzz\\r\\nzzzz\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'zzzz\\r\\nzz\\r\\nzz\\r\\n', 'output': ['both\\r\\n']}, {'input': 'aabaa\\r\\naab\\r\\nbaa\\r\\n', 'output': ['fantasy\\r\\n']}, {'input': 'aabaab\\r\\naba\\r\\nab\\r\\n', 'output': ['forward\\r\\n']}, {'input': 'aab\\r\\nb\\r\\naa\\r\\n', 'output': ['backward\\r\\n']}, {'input': 'abacaba\\r\\naca\\r\\nba\\r\\n', 'output': ['both\\r\\n']}]","id":197} {"description":"And again a misfortune fell on Poor Student. He is being late for an exam.Having rushed to a bus stop that is in point (0,\u20090), he got on a minibus and they drove along a straight line, parallel to axis OX, in the direction of increasing x.Poor Student knows the following: during one run the minibus makes n stops, the i-th stop is in point (xi,\u20090) coordinates of all the stops are different the minibus drives at a constant speed, equal to vb it can be assumed the passengers get on and off the minibus at a bus stop momentarily Student can get off the minibus only at a bus stop Student will have to get off the minibus at a terminal stop, if he does not get off earlier the University, where the exam will be held, is in point (xu,\u2009yu) Student can run from a bus stop to the University at a constant speed vs as long as needed a distance between two points can be calculated according to the following formula: Student is already on the minibus, so, he cannot get off at the first bus stop Poor Student wants to get to the University as soon as possible. Help him to choose the bus stop, where he should get off. If such bus stops are multiple, choose the bus stop closest to the University.","input_specification":"The first line contains three integer numbers: 2\u2009\u2264\u2009n\u2009\u2264\u2009100, 1\u2009\u2264\u2009vb,\u2009vs\u2009\u2264\u20091000. The second line contains n non-negative integers in ascending order: coordinates xi of the bus stop with index i. It is guaranteed that x1 equals to zero, and xn\u2009\u2264\u2009105. The third line contains the coordinates of the University, integers xu and yu, not exceeding 105 in absolute value. ","output_specification":"In the only line output the answer to the problem \u2014 index of the optimum bus stop.","notes":"NoteAs you know, students are a special sort of people, and minibuses usually do not hurry. That's why you should not be surprised, if Student's speed is higher than the speed of the minibus.","sample_inputs":["4 5 2\n0 2 4 6\n4 1","2 1 1\n0 100000\n100000 100000"],"sample_outputs":["3","2"],"src_uid":"15fa49860e978d3b3fb7a20bf9f8aa86","lang_cluster":"C","difficulty":1200,"human_solution":"#include \n#include \n\ntypedef struct entier\n {\n int T[30];\n }entier;\n\nentier transformer(int x)\n {\n entier y;\n if (x==0)\n {\n y.T[0] = 1;\n y.T[1] = 0;\n return y;\n }\n int z;\n z = x;\n y.T[0] = 0;\n while (z!=0)\n {\n y.T[0]++;\n y.T[y.T[0]] = z % 10;\n z = z \/ 10;\n }\n\n return y;\n }\n\nentier somme(entier x,entier y)\n {\n if ((x.T[0]==1) && (x.T[1]==0)) return y;\n if ((y.T[0]==1) && (y.T[1]==0)) return x;\n int i,retenu;\n entier z;\n z.T[0] = 0;\n i = 1;\n retenu = 0;\n while ((i<=x.T[0]) || (i<=y.T[0]) || (retenu!=0))\n {\n z.T[0]++;\n if (i<=x.T[0]) retenu = retenu + x.T[i];\n if (i<=y.T[0]) retenu = retenu + y.T[i];\n z.T[z.T[0]] = retenu % 10;\n retenu = retenu \/ 10;\n i++;\n }\n return z;\n }\n\nentier difference(entier x,entier y)\n {\n if ((y.T[0]==1) && (y.T[1]==0)) return x;\n int i,retenu;\n entier z;\n z.T[0] = 0;\n retenu = 0;\n for (i=1;i<=x.T[0];i++)\n {\n z.T[0]++;\n if (i<=y.T[0]) retenu = retenu + y.T[i];\n if (x.T[i]0;i--) z.T[i+x] = y.T[i];\n for (i=1;i<=x;i++) z.T[i] = 0;\n return z;\n }\n\nentier produit(entier x,entier y)\n {\n if ((x.T[0]==1) && (x.T[1]==0)) return x;\n if ((y.T[0]==1) && (y.T[1]==0)) return y;\n int i;\n entier z;\n z = transformer(0);\n for (i=1;i<=y.T[0];i++) z = somme(z,decalage(i-1,multiplierChiffre(y.T[i],x)));\n return z;\n }\n\nint comparer(entier x,entier y)\n {\n if (x.T[0]=0) printf(\"2\");\n else\n {\n \/\/x2x(i0+1) + xi0\n if (comparer(produit(transformer(vb * vb),transformer((2 * xu) - x[i] - x[i-1])),produit(transformer(vs * vs),transformer(x[i] - x[i-1])))<=0) printf(\"%d\",i);\n else\n {\n if (comparer(produit(difference(produit(transformer(vb * vb),transformer((2 * xu) - x[i] - x[i-1])),produit(transformer(vs * vs),transformer(x[i] - x[i-1]))),difference(produit(transformer(vb * vb),transformer((2 * xu) - x[i] - x[i-1])),produit(transformer(vs * vs),transformer(x[i] - x[i-1])))),multiplierChiffre(4,produit(produit(transformer(vb * vb),transformer(vs * vs)),somme(transformer((x[i] - xu) * (x[i] - xu)),transformer(yu * yu)))))<0) printf(\"%d\",i);\n else printf(\"%d\",(i+1));\n }\n }\n }\n }\n }\n }\n }\n }\n }\n","testcases":"[{'input': '4 5 2\\r\\n0 2 4 6\\r\\n4 1\\r\\n', 'output': ['3']}, {'input': '2 1 1\\r\\n0 100000\\r\\n100000 100000\\r\\n', 'output': ['2']}, {'input': '6 5 1\\r\\n0 1 2 3 4 5\\r\\n0 0\\r\\n', 'output': ['2']}, {'input': '4 100 10\\r\\n0 118 121 178\\r\\n220 220\\r\\n', 'output': ['4']}, {'input': '4 3 3\\r\\n0 6 8 10\\r\\n7 -4\\r\\n', 'output': ['2']}, {'input': '5 900 1\\r\\n0 37474 80030 85359 97616\\r\\n-1 -1\\r\\n', 'output': ['2']}, {'input': '5 200 400\\r\\n0 8068 28563 51720 66113\\r\\n5423 -34\\r\\n', 'output': ['2']}, {'input': '6 10 3\\r\\n0 12 14 16 19 20\\r\\n14 0\\r\\n', 'output': ['3']}, {'input': '6 13 11\\r\\n0 16 27 31 39 42\\r\\n54 3\\r\\n', 'output': ['6']}, {'input': '11 853 721\\r\\n0 134 1971 2369 3381 3997 4452 6875 8983 9360 9399\\r\\n7345 333\\r\\n', 'output': ['8']}, {'input': '35 35 12\\r\\n0 90486 90543 90763 91127 91310 92047 92405 93654 93814 94633 94752 94969 94994 95287 96349 96362 96723 96855 96883 97470 97482 97683 97844 97926 98437 98724 98899 98921 99230 99253 99328 99444 99691 99947\\r\\n96233 -7777\\r\\n', 'output': ['9']}, {'input': '55 11 44\\r\\n0 3343 3387 3470 3825 3832 3971 4026 4043 4389 4492 4886 5015 5084 5161 5436 5595 5616 5677 5987 6251 6312 6369 6469 6487 6493 6507 6641 6928 7067 7159 7280 7303 7385 7387 7465 7536 7572 7664 7895 7921 7955 8110 8191 8243 8280 8523 8525 8581 8877 9221 9462 9505 9594 9596\\r\\n8000 0\\r\\n', 'output': ['2']}, {'input': '72 1000 777\\r\\n0 215 2814 5104 5226 5925 6734 9213 11697 13739 14015 16101 17234 19013 19566 19683 20283 20837 21332 21432 25490 26284 27728 29911 30112 30133 31494 31595 32499 32932 33289 36611 37736 43548 44440 44537 47656 47699 48327 50942 52178 53759 56925 57671 62024 65441 67958 70346 71606 75235 75466 75553 75905 76173 76512 77784 78183 80425 81339 81543 84537 88384 89953 90214 92107 92274 93328 93550 93987 97546 99459 99532\\r\\n63421 35\\r\\n', 'output': ['45']}, {'input': '76 1 1\\r\\n0 1000 1754 2749 3687 4983 8121 10299 11043 12986 14125 15910 17070 17189 17551 17953 17973 20816 25436 26150 27446 27788 28466 28941 29537 33965 37566 40845 40930 41304 41614 41615 43042 45098 45844 49878 50453 50936 55480 58410 59258 59287 62789 64127 64333 64450 64862 65404 66451 67626 69294 69804 71988 72165 74196 74560 75407 76611 77055 77344 79470 83566 84550 87458 87627 88205 89880 90255 90586 91970 93795 95308 99032 99442 99547 99549\\r\\n0 0\\r\\n', 'output': ['2']}, {'input': '94 2 1\\r\\n0 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093\\r\\n5050 -100000\\r\\n', 'output': ['2']}, {'input': '100 1 2\\r\\n0 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\\r\\n100 0\\r\\n', 'output': ['2']}, {'input': '100 1000 1\\r\\n0 505 506 514 515 520 523 527 529 530 538 547 550 554 559 562 566 568 569 580 582 584 588 597 609 621 624 629 630 631 634 641 646 653 657 666 673 678 680 683 685 690 695 698 699 700 705 709 716 731 734 735 736 738 756 761 762 765 769 772 776 779 784 790 794 812 814 816 833 837 842 845 850 854 855 863 868 872 882 892 893 898 899 900 901 902 915 916 917 932 936 954 962 968 975 978 983 992 996 998\\r\\n600 7778\\r\\n', 'output': ['23']}, {'input': '2 1 1\\r\\n0 100000\\r\\n-100000 -100000\\r\\n', 'output': ['2']}, {'input': '2 1000 1000\\r\\n0 1\\r\\n1 0\\r\\n', 'output': ['2']}, {'input': '3 1 1\\r\\n0 1 2\\r\\n2 0\\r\\n', 'output': ['3']}]","id":198} {"description":"A new cottage village called \u00abFlatville\u00bb is being built in Flatland. By now they have already built in \u00abFlatville\u00bb n square houses with the centres on the \u041ex-axis. The houses' sides are parallel to the coordinate axes. It's known that no two houses overlap, but they can touch each other.The architect bureau, where Peter works, was commissioned to build a new house in \u00abFlatville\u00bb. The customer wants his future house to be on the \u041ex-axis, to be square in shape, have a side t, and touch at least one of the already built houses. For sure, its sides should be parallel to the coordinate axes, its centre should be on the Ox-axis and it shouldn't overlap any of the houses in the village.Peter was given a list of all the houses in \u00abFlatville\u00bb. Would you help him find the amount of possible positions of the new house?","input_specification":"The first line of the input data contains numbers n and t (1\u2009\u2264\u2009n,\u2009t\u2009\u2264\u20091000). Then there follow n lines, each of them contains two space-separated integer numbers: xi ai, where xi \u2014 x-coordinate of the centre of the i-th house, and ai \u2014 length of its side (\u2009-\u20091000\u2009\u2264\u2009xi\u2009\u2264\u20091000, 1\u2009\u2264\u2009ai\u2009\u2264\u20091000).","output_specification":"Output the amount of possible positions of the new house.","notes":"NoteIt is possible for the x-coordinate of the new house to have non-integer value.","sample_inputs":["2 2\n0 4\n6 2","2 2\n0 4\n5 2","2 3\n0 4\n5 2"],"sample_outputs":["4","3","2"],"src_uid":"c31fed523230af1f904218b2fe0d663d","lang_cluster":"C","difficulty":1200,"human_solution":"#include \n#include \n\nint x[1101], a[1101];\n\nint main ()\n{\n\tint n, i, j, t, ans = 0;\n\tscanf (\"%d %d\", &n, &t);\n\tfor (i=1;i<=n;++i)\n\t\tscanf (\"%d %d\", &x[i], &a[i]);\n\tfor (i =-4400;i<=4400;++i)\n\t{\n\t\tint b = 0;\n\t\tfor (j=1;j<=n;++j)\n\t\t{\n\t\t\tint k=abs(x[j]*2-i);\n\t\t\tif (k == t + a[j])\n\t\t\t\tb=1;\n\t\t\telse if (k < t + a[j])\n\t\t\t\tbreak;\n\t\t}\n\t\tif (j > n)\n\t\t\tans+=b;\n\t}\n\tprintf (\"%d\\n\", ans);\n\treturn 0;\n}\n\n","testcases":"[{'input': '2 2\\r\\n0 4\\r\\n6 2\\r\\n', 'output': ['4\\r\\n']}, {'input': '2 2\\r\\n0 4\\r\\n5 2\\r\\n', 'output': ['3\\r\\n']}, {'input': '2 3\\r\\n0 4\\r\\n5 2\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 1\\r\\n1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '1 2\\r\\n2 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 1\\r\\n2 1\\r\\n1 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '2 2\\r\\n0 4\\r\\n7 4\\r\\n', 'output': ['4\\r\\n']}, {'input': '4 1\\r\\n-12 1\\r\\n-14 1\\r\\n4 1\\r\\n-11 1\\r\\n', 'output': ['5\\r\\n']}, {'input': '6 15\\r\\n19 1\\r\\n2 3\\r\\n6 2\\r\\n-21 2\\r\\n-15 2\\r\\n23 1\\r\\n', 'output': ['2\\r\\n']}, {'input': '10 21\\r\\n-61 6\\r\\n55 2\\r\\n-97 1\\r\\n37 1\\r\\n-39 1\\r\\n26 2\\r\\n21 1\\r\\n64 3\\r\\n-68 1\\r\\n-28 6\\r\\n', 'output': ['6\\r\\n']}, {'input': '26 51\\r\\n783 54\\r\\n-850 6\\r\\n-997 59\\r\\n573 31\\r\\n-125 20\\r\\n472 52\\r\\n101 5\\r\\n-561 4\\r\\n625 35\\r\\n911 14\\r\\n-47 33\\r\\n677 55\\r\\n-410 54\\r\\n13 53\\r\\n173 31\\r\\n968 30\\r\\n-497 7\\r\\n832 42\\r\\n271 59\\r\\n-638 52\\r\\n-301 51\\r\\n378 36\\r\\n-813 7\\r\\n-206 22\\r\\n-737 37\\r\\n-911 9\\r\\n', 'output': ['35\\r\\n']}, {'input': '14 101\\r\\n121 88\\r\\n-452 91\\r\\n635 28\\r\\n-162 59\\r\\n-872 26\\r\\n-996 8\\r\\n468 86\\r\\n742 63\\r\\n892 89\\r\\n-249 107\\r\\n300 51\\r\\n-753 17\\r\\n-620 31\\r\\n-13 34\\r\\n', 'output': ['16\\r\\n']}, {'input': '3 501\\r\\n827 327\\r\\n-85 480\\r\\n-999 343\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 999\\r\\n-999 471\\r\\n530 588\\r\\n', 'output': ['4\\r\\n']}, {'input': '22 54\\r\\n600 43\\r\\n806 19\\r\\n-269 43\\r\\n-384 78\\r\\n222 34\\r\\n392 10\\r\\n318 30\\r\\n488 73\\r\\n-756 49\\r\\n-662 22\\r\\n-568 50\\r\\n-486 16\\r\\n-470 2\\r\\n96 66\\r\\n864 16\\r\\n934 15\\r\\n697 43\\r\\n-154 30\\r\\n775 5\\r\\n-876 71\\r\\n-33 78\\r\\n-991 31\\r\\n', 'output': ['30\\r\\n']}, {'input': '17 109\\r\\n52 7\\r\\n216 24\\r\\n-553 101\\r\\n543 39\\r\\n391 92\\r\\n-904 67\\r\\n95 34\\r\\n132 14\\r\\n730 103\\r\\n952 118\\r\\n-389 41\\r\\n-324 36\\r\\n-74 2\\r\\n-147 99\\r\\n-740 33\\r\\n233 1\\r\\n-995 3\\r\\n', 'output': ['16\\r\\n']}, {'input': '4 512\\r\\n-997 354\\r\\n-568 216\\r\\n-234 221\\r\\n603 403\\r\\n', 'output': ['4\\r\\n']}, {'input': '3 966\\r\\n988 5\\r\\n15 2\\r\\n-992 79\\r\\n', 'output': ['6\\r\\n']}, {'input': '2 1000\\r\\n-995 201\\r\\n206 194\\r\\n', 'output': ['4\\r\\n']}, {'input': '50 21\\r\\n-178 1\\r\\n49 1\\r\\n-98 1\\r\\n-220 1\\r\\n152 1\\r\\n-160 3\\r\\n17 2\\r\\n77 1\\r\\n-24 1\\r\\n214 2\\r\\n-154 2\\r\\n-141 1\\r\\n79 1\\r\\n206 1\\r\\n8 1\\r\\n-208 1\\r\\n36 1\\r\\n231 3\\r\\n-2 2\\r\\n-130 2\\r\\n-14 2\\r\\n34 1\\r\\n-187 2\\r\\n14 1\\r\\n-83 2\\r\\n-241 1\\r\\n149 2\\r\\n73 1\\r\\n-233 3\\r\\n-45 1\\r\\n197 1\\r\\n145 2\\r\\n-127 2\\r\\n-229 4\\r\\n-85 1\\r\\n-66 1\\r\\n-76 2\\r\\n104 1\\r\\n175 1\\r\\n70 1\\r\\n131 3\\r\\n-108 1\\r\\n-5 4\\r\\n140 1\\r\\n33 1\\r\\n248 3\\r\\n-36 3\\r\\n134 1\\r\\n-183 1\\r\\n56 2\\r\\n', 'output': ['9\\r\\n']}, {'input': '50 1\\r\\n37 1\\r\\n-38 1\\r\\n7 1\\r\\n47 1\\r\\n-4 1\\r\\n24 1\\r\\n-32 1\\r\\n-23 1\\r\\n-3 1\\r\\n-19 1\\r\\n5 1\\r\\n-50 1\\r\\n11 1\\r\\n-11 1\\r\\n49 1\\r\\n-39 1\\r\\n0 1\\r\\n43 1\\r\\n-10 1\\r\\n6 1\\r\\n19 1\\r\\n1 1\\r\\n27 1\\r\\n29 1\\r\\n-47 1\\r\\n-40 1\\r\\n-46 1\\r\\n-26 1\\r\\n-42 1\\r\\n-37 1\\r\\n13 1\\r\\n-29 1\\r\\n-30 1\\r\\n3 1\\r\\n44 1\\r\\n10 1\\r\\n4 1\\r\\n-14 1\\r\\n-2 1\\r\\n34 1\\r\\n18 1\\r\\n-33 1\\r\\n-44 1\\r\\n9 1\\r\\n-36 1\\r\\n-7 1\\r\\n25 1\\r\\n22 1\\r\\n-20 1\\r\\n-41 1\\r\\n', 'output': ['43\\r\\n']}, {'input': '50 1\\r\\n-967 7\\r\\n696 7\\r\\n-366 4\\r\\n557 1\\r\\n978 2\\r\\n800 4\\r\\n-161 2\\r\\n-773 2\\r\\n-248 2\\r\\n134 3\\r\\n869 6\\r\\n-932 2\\r\\n-262 14\\r\\n191 3\\r\\n669 2\\r\\n72 5\\r\\n0 1\\r\\n757 8\\r\\n859 2\\r\\n-131 8\\r\\n-169 3\\r\\n543 10\\r\\n-120 2\\r\\n-87 8\\r\\n-936 6\\r\\n-620 3\\r\\n-281 11\\r\\n684 3\\r\\n886 10\\r\\n497 4\\r\\n380 4\\r\\n833 1\\r\\n-727 6\\r\\n470 11\\r\\n584 9\\r\\n66 6\\r\\n-609 12\\r\\n-661 4\\r\\n-57 8\\r\\n628 7\\r\\n635 4\\r\\n-924 3\\r\\n-982 4\\r\\n-201 7\\r\\n-9 8\\r\\n-560 9\\r\\n712 7\\r\\n-330 8\\r\\n-191 1\\r\\n-892 7\\r\\n', 'output': ['96\\r\\n']}, {'input': '1 1000\\r\\n0 1000\\r\\n', 'output': ['2\\r\\n']}]","id":199} {"description":"Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three digits.","input_specification":"The first line contains integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of digits in the phone number. The second line contains n digits \u2014 the phone number to divide into groups.","output_specification":"Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.","notes":null,"sample_inputs":["6\n549871","7\n1198733"],"sample_outputs":["54-98-71","11-987-33"],"src_uid":"6f6859aabc1c9cbb9ee0d910064d87c2","lang_cluster":"C","difficulty":1100,"human_solution":"#include\nint main()\n{\n int n,i,j;\n scanf(\"%d\",&n);\n char a[n+1];\n scanf(\"%s\",a);\n if(n%2==0){\n printf(\"%c%c\",a[0],a[1]);\n for(i=2;a[i]!='\\0';i+=2){\n printf(\"-\");\n for(j=i;j\n int power(int x, int n) {\n int index, temp = x;\n for(index = 1 ; index < n ; index++)\n temp = x*temp;\n return temp; \n}\nint main() {\nint a,b,n,result,negorpos=1,x;\nscanf(\"%d %d %d\",&a,&b,&n);\nif(b==0 && a==0){\n printf(\"5\");\n return 0;\n}\nif(a==0&&b!=0) {\n printf(\"No solution\");\n return 0;\n}\n\nif(((a<0)&&(b>0)&&(n%2==1))||((a>0)&&(b<0)&&(n%2==1)))\n negorpos=-1;\nif(a*b<0 && n%2==0) {\n printf(\"No solution\");\n return 0;\n}\n \n\nif(a<0) a=-a;\nif(b<0) b=-b;\n\n for(x =0 ; x <= 1000 ; x++){\n if(power(x,n)*a ==b) {\n printf(\"%d\",x*negorpos);\n return 0;\n }\n if(power(x,n)*a > b){\n printf(\"No solution\");\n return 0;\n }\n } \n return 0;\n}\n","testcases":"[{'input': '2 18 2\\r\\n', 'output': ['3']}, {'input': '-1 8 3\\r\\n', 'output': ['-2']}, {'input': '0 0 10\\r\\n', 'output': ['5']}, {'input': '1 16 5\\r\\n', 'output': ['No solution']}, {'input': '0 1 2\\r\\n', 'output': ['No solution']}, {'input': '3 0 4\\r\\n', 'output': ['0']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '4 972 1\\r\\n', 'output': ['243']}, {'input': '-1 -1 5\\r\\n', 'output': ['1']}, {'input': '-1 0 4\\r\\n', 'output': ['0']}, {'input': '-7 0 1\\r\\n', 'output': ['0']}, {'input': '-5 -5 3\\r\\n', 'output': ['1']}, {'input': '-5 -5 9\\r\\n', 'output': ['1']}, {'input': '-5 -5 6\\r\\n', 'output': ['1']}, {'input': '-4 0 1\\r\\n', 'output': ['0']}, {'input': '-5 0 3\\r\\n', 'output': ['0']}, {'input': '-4 4 9\\r\\n', 'output': ['-1']}, {'input': '10 0 6\\r\\n', 'output': ['0']}, {'input': '-5 3 4\\r\\n', 'output': ['No solution']}, {'input': '0 3 6\\r\\n', 'output': ['No solution']}, {'input': '3 6 10\\r\\n', 'output': ['No solution']}, {'input': '-3 7 5\\r\\n', 'output': ['No solution']}, {'input': '-526 526 1\\r\\n', 'output': ['-1']}, {'input': '-373 373 3\\r\\n', 'output': ['-1']}, {'input': '-141 0 8\\r\\n', 'output': ['0']}, {'input': '7 175 1\\r\\n', 'output': ['25']}, {'input': '-5 -560 1\\r\\n', 'output': ['112']}, {'input': '-1 -512 10\\r\\n', 'output': ['No solution']}, {'input': '-3 -768 8\\r\\n', 'output': ['2']}, {'input': '-3 -768 7\\r\\n', 'output': ['No solution']}, {'input': '-3 -768 9\\r\\n', 'output': ['No solution']}, {'input': '-3 -768 4\\r\\n', 'output': ['4']}, {'input': '4 972 4\\r\\n', 'output': ['No solution']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '4 972 6\\r\\n', 'output': ['No solution']}, {'input': '4 972 1\\r\\n', 'output': ['243']}, {'input': '4 972 2\\r\\n', 'output': ['No solution']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '1 961 2\\r\\n', 'output': ['31']}, {'input': '1 1000 3\\r\\n', 'output': ['10']}, {'input': '1 625 4\\r\\n', 'output': ['5']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '1 729 6\\r\\n', 'output': ['3']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '3 768 8\\r\\n', 'output': ['2']}, {'input': '1 512 9\\r\\n', 'output': ['2']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '1 961 2\\r\\n', 'output': ['31']}, {'input': '1 1000 3\\r\\n', 'output': ['10']}, {'input': '1 625 4\\r\\n', 'output': ['5']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '1 729 6\\r\\n', 'output': ['3']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '3 768 8\\r\\n', 'output': ['2']}, {'input': '1 512 9\\r\\n', 'output': ['2']}, {'input': '1 1000 1\\r\\n', 'output': ['1000']}, {'input': '1 961 2\\r\\n', 'output': ['31']}, {'input': '1 1000 3\\r\\n', 'output': ['10']}, {'input': '1 625 4\\r\\n', 'output': ['5']}, {'input': '4 972 5\\r\\n', 'output': ['3']}, {'input': '1 729 6\\r\\n', 'output': ['3']}, {'input': '7 896 7\\r\\n', 'output': ['2']}, {'input': '3 768 8\\r\\n', 'output': ['2']}, {'input': '1 512 9\\r\\n', 'output': ['2']}, {'input': '1 1 5\\r\\n', 'output': ['1']}, {'input': '1 1 4\\r\\n', 'output': ['1']}, {'input': '1 -1 1\\r\\n', 'output': ['-1']}]","id":201} {"description":"In a strategic computer game \"Settlers II\" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either increase or decrease.Every soldier has a rank \u2014 some natural number from 1 to k. 1 stands for a private and k stands for a general. The higher the rank of the soldier is, the better he fights. Therefore, the player profits from having the soldiers of the highest possible rank.To increase the ranks of soldiers they need to train. But the soldiers won't train for free, and each training session requires one golden coin. On each training session all the n soldiers are present.At the end of each training session the soldiers' ranks increase as follows. First all the soldiers are divided into groups with the same rank, so that the least possible number of groups is formed. Then, within each of the groups where the soldiers below the rank k are present, exactly one soldier increases his rank by one.You know the ranks of all n soldiers at the moment. Determine the number of golden coins that are needed to increase the ranks of all the soldiers to the rank k.","input_specification":"The first line contains two integers n and k (1\u2009\u2264\u2009n,\u2009k\u2009\u2264\u2009100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1\u2009\u2264\u2009i\u2009\u2264\u2009n, 1\u2009\u2264\u2009ai\u2009\u2264\u2009k).","output_specification":"Print a single integer \u2014 the number of golden coins needed to raise all the soldiers to the maximal rank.","notes":"NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 \u2009\u2192\u2009 2 2 3 4 \u2009\u2192\u2009 2 3 4 4 \u2009\u2192\u2009 3 4 4 4 \u2009\u2192\u2009 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.","sample_inputs":["4 4\n1 2 2 3","4 3\n1 1 1 1"],"sample_outputs":["4","5"],"src_uid":"3d6411d67c85f6293f1999ccff2cd8ba","lang_cluster":"C","difficulty":1200,"human_solution":"#include \n\nint Cnt[101];\n\nint main()\n{\n int n, k, a, ans = 0;\n scanf(\"%d %d\", &n, &k);\n for(int i = 0; i < n; ++i) {\n scanf(\"%d\", &a);\n ++Cnt[a];\n }\n while(1) {\n char update = 0;\n for(int i = k - 1; i >= 1; --i) {\n if(Cnt[i]) {\n --Cnt[i];\n ++Cnt[i + 1];\n update = 1;\n }\n }\n if(!update) {\n break;\n }\n ans += update;\n }\n printf(\"%d\\n\", ans);\n return 0;\n}\n","testcases":"[{'input': '4 4\\r\\n1 2 2 3\\r\\n', 'output': ['4']}, {'input': '4 3\\r\\n1 1 1 1\\r\\n', 'output': ['5']}, {'input': '3 3\\r\\n1 2 3\\r\\n', 'output': ['2']}, {'input': '1 1\\r\\n1\\r\\n', 'output': ['0']}, {'input': '1 5\\r\\n1\\r\\n', 'output': ['4']}, {'input': '1 5\\r\\n4\\r\\n', 'output': ['1']}, {'input': '2 6\\r\\n2 5\\r\\n', 'output': ['4']}, {'input': '6 10\\r\\n1 1 3 4 9 9\\r\\n', 'output': ['10']}, {'input': '7 7\\r\\n1 1 1 1 1 1 7\\r\\n', 'output': ['11']}, {'input': '10 10\\r\\n1 1 1 3 3 4 7 8 8 8\\r\\n', 'output': ['11']}, {'input': '10 13\\r\\n1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['21']}, {'input': '10 13\\r\\n2 6 6 7 9 9 9 10 12 12\\r\\n', 'output': ['11']}, {'input': '17 9\\r\\n2 3 4 5 5 5 5 5 6 6 7 7 8 8 8 8 8\\r\\n', 'output': ['17']}, {'input': '18 24\\r\\n3 3 3 4 5 7 8 8 9 9 9 9 10 10 11 11 11 11\\r\\n', 'output': ['30']}, {'input': '23 2\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2\\r\\n', 'output': ['12']}, {'input': '37 42\\r\\n1 1 1 1 1 2 2 2 2 2 3 4 4 4 4 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8\\r\\n', 'output': ['70']}, {'input': '44 50\\r\\n38 38 38 38 38 38 38 39 39 39 39 39 39 39 40 40 40 40 40 41 41 41 41 41 41 41 42 42 42 43 43 43 44 44 44 44 45 45 45 46 46 46 46 46\\r\\n', 'output': ['47']}, {'input': '57 100\\r\\n2 2 4 7 8 10 12 12 14 15 16 18 19 21 21 22 25 26 26 33 38 40 44 44 44 45 47 47 50 51 51 54 54 54 54 55 56 58 61 65 67 68 68 70 74 75 78 79 83 86 89 90 92 95 96 96 97\\r\\n', 'output': ['99']}, {'input': '78 10\\r\\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9\\r\\n', 'output': ['78']}, {'input': '96 78\\r\\n20 20 20 20 20 21 21 21 22 23 23 24 24 25 25 27 28 29 30 30 30 32 32 32 33 33 33 33 34 34 35 36 37 37 39 39 41 41 41 41 42 42 43 43 43 44 44 45 46 46 48 48 49 50 51 51 51 52 53 55 55 56 56 56 56 57 58 59 60 61 61 61 62 62 62 63 63 64 64 64 65 65 65 66 66 67 68 69 71 72 72 73 73 75 75 75\\r\\n', 'output': ['98']}, {'input': '100 1\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['0']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\r\\n', 'output': ['198']}, {'input': '100 100\\r\\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\\r\\n', 'output': ['0']}, {'input': '100 100\\r\\n1 1 4 4 5 5 7 9 10 10 11 11 12 12 12 13 14 15 16 16 16 17 18 18 19 20 22 25 26 27 29 32 33 34 34 35 35 35 36 36 37 37 38 39 39 40 41 42 44 44 46 47 47 47 47 50 53 53 53 55 56 56 57 57 58 58 59 59 62 64 64 64 64 68 68 68 69 70 70 71 74 77 77 77 79 80 80 81 84 86 88 88 91 93 94 96 96 99 99 99\\r\\n', 'output': ['108']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 8 8 8 8 8 9 9 9 9 9 9 9 10 10 10 10 10 11 11 11 11 11 12 12 12 12 12 12 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 14 14 14 14 15 15 15 15 15\\r\\n', 'output': ['184']}, {'input': '100 100\\r\\n20 20 20 21 21 21 21 21 22 23 23 23 23 23 23 24 24 25 25 26 26 26 26 26 27 27 27 27 28 28 28 28 29 29 29 29 29 30 30 30 30 31 32 32 34 34 34 34 34 34 34 34 35 35 35 36 36 37 37 37 37 37 37 38 38 38 39 40 41 41 42 42 42 42 42 43 43 43 44 44 44 44 44 45 45 45 45 45 46 46 46 46 46 47 47 47 48 48 48 50\\r\\n', 'output': ['150']}, {'input': '100 2\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\r\\n', 'output': ['59']}, {'input': '30 50\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 49\\r\\n', 'output': ['77']}, {'input': '40 20\\r\\n5 5 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 20 20 20 20 20 20 20 20 20 20\\r\\n', 'output': ['31']}, {'input': '81 90\\r\\n1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90\\r\\n', 'output': ['89']}, {'input': '100 20\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 13 13 13 13 13 13 13 13 13\\r\\n', 'output': ['106']}, {'input': '100 100\\r\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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\\r\\n', 'output': ['197']}, {'input': '100 100\\r\\n49 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 51\\r\\n', 'output': ['148']}, {'input': '1 100\\r\\n1\\r\\n', 'output': ['99']}, {'input': '4 3\\r\\n1 1 2 2\\r\\n', 'output': ['4']}, {'input': '10 100\\r\\n98 99 99 99 99 99 99 100 100 100\\r\\n', 'output': ['7']}, {'input': '5 100\\r\\n1 2 2 100 100\\r\\n', 'output': ['100']}]","id":202} {"description":"Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1\u2009\u00d7\u2009n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed height and due to the newest irrigation system we can create artificial rain above each section.Creating artificial rain is an expensive operation. That's why we limit ourselves to creating the artificial rain only above one section. At that, the water from each watered section will flow into its neighbouring sections if their height does not exceed the height of the section. That is, for example, the garden can be represented by a 1\u2009\u00d7\u20095 rectangle, where the section heights are equal to 4, 2, 3, 3, 2. Then if we create an artificial rain over any of the sections with the height of 3, the water will flow over all the sections, except the ones with the height of 4. See the illustration of this example at the picture: As Petya is keen on programming, he decided to find such a section that if we create artificial rain above it, the number of watered sections will be maximal. Help him. ","input_specification":"The first line contains a positive integer n (1\u2009\u2264\u2009n\u2009\u2264\u20091000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.","output_specification":"Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.","notes":null,"sample_inputs":["1\n2","5\n1 2 1 2 1","8\n1 2 1 1 1 3 3 4"],"sample_outputs":["1","3","6"],"src_uid":"5d11fa8528f1dc873d50b3417bef8c79","lang_cluster":"C","difficulty":1100,"human_solution":"#include \n#include \n\nint main()\n{\n int n, m = 0, S = 0, j, x, large = 0;\n scanf(\"%d\", &n);\n int array[n], arr[n];\n for(int i = 0; i < n; i++)\n {\n scanf(\"%d\", &array[i]);\n }\n if(n == 1)\n {\n printf(\"1\");\n return 0;\n }\n else if(n == 2)\n {\n printf(\"2\");\n return 0;\n }\n else\n {\n if(array[0] > array[1])\n {\n arr[m] = 0;\n m++;\n \/\/printf(\"%d\\n\", m);\n S = 1;\n }\n if(array[n - 1] > array[n - 2])\n {\n arr[m] = n - 1;\n m++;\n \/\/printf(\"%d\\n\", m);\n S = 1;\n }\n for(int i = 1; i < n - 1; i++)\n {\n if(array[i - 1] < array[i])\n {\n \/\/printf(\"%d\\n\", i);\n \/\/printf(\"%d\\n\", array[i]);\n \/\/printf(\"%d\\n\", array[i + 1]);\n while(array[i] == array[i + 1])\n {\n if(i == n - 1)\n {\n arr[m] = n - 1;\n \/\/printf(\"%d\\n\", m);\n m++;\n }\n i++;\n }\n \/\/printf(\"%d\\n\", i);\n if(array[i] > array[i + 1])\n {\n arr[m] = i;\n m++;\n \/\/printf(\"%d\\n\", m);\n S = 1;\n }\n }\n }\n if(S == 0 || m == 1)\n {\n printf(\"%d\", n);\n return 0;\n }\n else\n {\n for(int i = 0; i < m; i++)\n {\n if(arr[i] == 0)\n {\n j = 0; x = 1;\n while(!(array[j] < array[j + 1]))\n {\n x++;\n if(j == n - 2)\n {\n break;\n }\n j++;\n }\n if(x > large)\n {\n large = x;\n }\n }\n else if(arr[i] == n - 1)\n {\n j = n - 1; x = 1;\n while(!(array[j] < array[j - 1]))\n {\n x++;\n if(j == 1)\n {\n break;\n }\n j--;\n }\n if(x > large)\n {\n large = x;\n }\n }\n else\n {\n j = arr[i]; x = 1;\n while(!(array[j] < array[j + 1]))\n {\n x++;\n if(j == n - 2)\n {\n break;\n }\n j++;\n }\n j = arr[i];\n while(!(array[j] < array[j - 1]))\n {\n x++;\n if(j == 1)\n {\n break;\n }\n j--;\n }\n if(x > large)\n {\n large = x;\n }\n }\n }\n }\n }\n printf(\"%d\", large);\n \/\/for(int i = 0; i < m; i++)\n \/\/{\n \/\/ printf(\"%d \", arr[i]);\n \/\/}\n return 0;\n}\n","testcases":"[{'input': '1\\r\\n2\\r\\n', 'output': ['1\\r\\n']}, {'input': '5\\r\\n1 2 1 2 1\\r\\n', 'output': ['3\\r\\n']}, {'input': '8\\r\\n1 2 1 1 1 3 3 4\\r\\n', 'output': ['6\\r\\n']}, {'input': '10\\r\\n1 2 3 4 5 6 7 8 9 10\\r\\n', 'output': ['10\\r\\n']}, {'input': '10\\r\\n10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['10\\r\\n']}, {'input': '2\\r\\n100 100\\r\\n', 'output': ['2\\r\\n']}, {'input': '3\\r\\n100 100 100\\r\\n', 'output': ['3\\r\\n']}, {'input': '11\\r\\n1 2 3 4 5 6 5 4 3 2 1\\r\\n', 'output': ['11\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 100 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 1 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['61\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 100 5 4 3 2 1\\r\\n', 'output': ['81\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 1 86 87 88 89 90 91 92 93 100 6 5 4 3 2 1\\r\\n', 'output': ['85\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 1 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 100 7 6 5 4 3 2 1\\r\\n', 'output': ['61\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 100 8 7 6 1 4 3 2 1\\r\\n', 'output': ['96\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 100 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['100\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 1 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 100 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['55\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 1 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 100 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['59\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 100 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['86\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 100 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['83\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 100 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 1 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['74\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 100 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['100\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 100 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 1 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\\r\\n', 'output': ['52\\r\\n']}, {'input': '100\\r\\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 100 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 1 2 1\\r\\n', 'output': ['98\\r\\n']}, {'input': '10\\r\\n1 4 4 4 4 4 1 2 4 3\\r\\n', 'output': ['7\\r\\n']}]","id":203} {"description":"n soldiers stand in a circle. For each soldier his height ai is known. A reconnaissance unit can be made of such two neighbouring soldiers, whose heights difference is minimal, i.e. |ai\u2009-\u2009aj| is minimal. So each of them will be less noticeable with the other. Output any pair of soldiers that can form a reconnaissance unit.","input_specification":"The first line contains integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) \u2014 amount of soldiers. Then follow the heights of the soldiers in their order in the circle \u2014 n space-separated integers a1,\u2009a2,\u2009...,\u2009an (1\u2009\u2264\u2009ai\u2009\u2264\u20091000). The soldier heights are given in clockwise or counterclockwise direction.","output_specification":"Output two integers \u2014 indexes of neighbouring soldiers, who should form a reconnaissance unit. If there are many optimum solutions, output any of them. Remember, that the soldiers stand in a circle.","notes":null,"sample_inputs":["5\n10 12 13 15 10","4\n10 20 30 40"],"sample_outputs":["5 1","1 2"],"src_uid":"facd9cd4fc1e53f50a1e6f947d78e942","lang_cluster":"C","difficulty":800,"human_solution":"#include\n#include\nint main()\n{\n int n,c,d,t,m,s;\n scanf(\"%d\",&n);\n int a[n];\n for(int i=0;i\nmain()\n{\n int n,i,a,b,sum;\n sum=0;\n scanf(\"%d\",&n);\n int c[n];\n for(i=0;i\n\nint a[101][2];\nmain()\n{int i,j,k,sum,save,n,len,store,max;\nmax=0;\nsum=0;\nsave=0;\nscanf(\"%d%d\",&n,&len);\nfor(i=1;i<=n;i++)\n{\nscanf(\"%d\",&store);\nif(store>max)\n max=store;\na[store][0]++;\n}\n\n\n\n\nfor(i=len;i<=max;i++)\n{\n sum=0;\n for(j=i;j<=max;j++)\n sum=sum+(j\/i)*(a[j][0]);\n\n\/\/printf(\"%d\\n\",i*sum);\n if(i*sum>save){\n \/\/ printf(\"%d %d\\n\",i,sum);\n\n save=i*sum;\n }\n\n\n\n\n}\n\n\n\nprintf(\"%d\",save);\n\n}","testcases":"[{'input': '4 2\\r\\n1 2 3 4\\r\\n', 'output': ['8\\r\\n']}, {'input': '5 3\\r\\n5 5 7 3 1\\r\\n', 'output': ['15\\r\\n']}, {'input': '2 3\\r\\n1 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '2 2\\r\\n3 3\\r\\n', 'output': ['6\\r\\n']}, {'input': '5 2\\r\\n2 4 1 1 3\\r\\n', 'output': ['8\\r\\n']}, {'input': '7 4\\r\\n3 2 1 1 1 3 2\\r\\n', 'output': ['0\\r\\n']}, {'input': '10 1\\r\\n1 2 2 6 6 1 2 5 5 6\\r\\n', 'output': ['36\\r\\n']}, {'input': '10 2\\r\\n6 3 1 1 6 4 6 1 6 3\\r\\n', 'output': ['33\\r\\n']}, {'input': '15 6\\r\\n1 6 6 5 2 10 4 4 7 8 7 3 5 1 2\\r\\n', 'output': ['36\\r\\n']}, {'input': '20 2\\r\\n13 3 6 11 6 11 9 1 1 2 5 2 9 15 14 10 3 12 3 13\\r\\n', 'output': ['136\\r\\n']}, {'input': '25 20\\r\\n10 8 4 6 12 14 19 18 19 9 21 16 16 15 10 15 12 12 18 18 9 22 12 14 14\\r\\n', 'output': ['42\\r\\n']}, {'input': '30 15\\r\\n93 99 77 69 43 86 56 15 9 9 75 84 56 1 42 45 10 23 83 87 86 99 46 48 40 69 95 10 61 47\\r\\n', 'output': ['1455\\r\\n']}, {'input': '35 3\\r\\n13 12 38 45 71 61 42 75 58 40 50 70 27 38 16 37 21 12 36 7 39 4 65 12 32 26 1 21 66 63 29 56 32 29 26\\r\\n', 'output': ['1236\\r\\n']}, {'input': '40 33\\r\\n33 52 83 32 59 90 25 90 38 31 60 30 76 77 9 13 48 1 55 39 84 28 58 83 12 3 77 34 33 73 15 35 29 8 3 21 63 4 21 75\\r\\n', 'output': ['1089\\r\\n']}, {'input': '45 1\\r\\n1 1 2 3 1 2 3 1 1 1 1 2 2 2 2 3 1 1 2 2 3 3 2 3 3 1 3 3 3 1 2 3 2 1 2 1 1 2 1 2 1 1 2 2 2\\r\\n', 'output': ['84\\r\\n']}, {'input': '50 70\\r\\n60 21 1 35 20 10 35 59 27 12 57 67 76 49 27 72 39 47 56 36 36 13 62 16 6 16 39 46 35 9 67 59 61 52 1 44 70 40 60 3 5 2 14 29 56 32 4 28 35 73\\r\\n', 'output': ['280\\r\\n']}, {'input': '55 12\\r\\n15 5 11 16 17 3 5 28 19 15 1 9 5 26 25 3 14 14 33 12 3 21 16 30 22 18 7 16 24 28 2 17 24 25 16 16 31 9 11 9 6 13 25 23 32 18 4 21 10 32 11 5 4 32 14\\r\\n', 'output': ['588\\r\\n']}, {'input': '60 10\\r\\n42 89 35 19 51 41 31 77 10 8 73 27 47 26 66 91 43 33 74 62 77 23 5 44 18 23 74 6 51 21 30 17 31 39 74 4 55 39 3 34 21 3 18 41 61 37 31 91 69 55 75 67 77 30 11 16 35 68 62 19\\r\\n', 'output': ['2240\\r\\n']}, {'input': '65 7\\r\\n1 5 4 1 4 11 9 1 11 7 6 11 9 4 2 6 10 11 10 12 4 6 1 12 12 5 1 11 7 9 11 6 10 10 7 8 4 1 3 5 2 3 2 10 11 10 5 8 7 10 12 5 11 6 8 6 2 9 9 7 2 4 12 7 7\\r\\n', 'output': ['245\\r\\n']}, {'input': '70 12\\r\\n6 8 11 13 11 30 4 26 16 24 8 12 14 25 7 26 1 24 1 9 7 19 25 11 18 23 27 26 27 19 8 10 9 20 23 2 14 27 24 24 14 21 31 5 1 14 24 20 2 1 11 17 12 7 17 20 8 21 16 17 31 25 9 25 5 18 6 19 22 27\\r\\n', 'output': ['756\\r\\n']}, {'input': '75 19\\r\\n3 35 38 25 5 17 12 37 26 34 20 3 30 33 16 26 16 31 17 5 13 40 4 40 16 4 24 31 39 13 12 3 25 40 21 2 27 26 21 2 18 24 24 25 18 3 15 20 5 6 23 10 16 37 20 13 39 4 6 28 9 25 14 7 6 15 34 9 4 16 36 19 17 30 33\\r\\n', 'output': ['817\\r\\n']}, {'input': '80 1\\r\\n7 13 38 24 17 20 11 3 25 23 36 16 41 36 18 9 33 10 37 20 8 7 42 8 17 1 39 30 39 24 36 17 8 11 3 33 23 42 36 16 36 3 30 20 29 35 43 17 32 26 33 4 41 34 9 37 14 26 6 40 16 24 8 26 16 31 11 12 18 24 42 34 24 37 5 23 32 13 8 14\\r\\n', 'output': ['1810\\r\\n']}, {'input': '85 2\\r\\n26 5 48 55 22 22 43 29 55 29 6 53 48 35 58 22 44 7 14 26 48 17 66 44 2 10 50 4 19 35 29 61 55 57 25 5 54 64 18 17 43 16 14 63 46 22 55 23 8 52 65 30 10 13 24 18 7 44 65 7 42 63 29 54 32 23 55 17 3 11 67 14 45 31 33 22 36 28 27 54 46 45 15 40 55\\r\\n', 'output': ['2796\\r\\n']}, {'input': '90 3\\r\\n44 16 62 40 33 17 53 32 66 18 68 33 18 76 14 66 41 8 18 57 39 63 9 41 30 39 30 35 46 12 27 33 6 4 21 26 32 24 18 25 35 39 14 49 65 32 54 38 55 64 75 2 53 21 72 11 46 47 63 60 33 62 13 35 40 21 26 15 66 74 55 48 24 26 76 69 65 68 62 12 74 58 21 13 53 5 40 56 66 67\\r\\n', 'output': ['3492\\r\\n']}, {'input': '91 6\\r\\n4 2 4 2 6 2 4 1 2 6 5 3 3 3 3 2 5 4 2 5 3 2 1 3 5 2 4 5 1 3 3 3 6 6 5 3 4 1 5 6 2 5 2 2 5 4 1 5 4 1 2 6 1 2 3 4 3 3 3 3 2 1 4 5 1 6 5 1 6 5 3 5 6 3 3 5 4 4 5 4 5 2 5 2 3 1 5 6 6 4 2\\r\\n', 'output': ['66\\r\\n']}, {'input': '92 8\\r\\n3 4 6 9 7 9 12 12 7 4 9 1 3 9 2 12 4 5 12 2 6 5 9 9 5 2 7 5 12 2 1 7 7 11 11 1 4 10 11 7 5 6 3 5 12 2 9 1 11 1 9 11 1 9 7 9 7 8 1 5 8 8 1 8 6 6 4 5 6 10 7 9 7 1 6 2 12 11 7 6 12 11 5 11 6 10 1 9 3 9 11 9\\r\\n', 'output': ['306\\r\\n']}, {'input': '93 10\\r\\n6 47 6 89 21 91 51 72 32 48 54 89 36 12 25 38 58 62 54 16 5 52 52 85 67 33 81 72 6 42 91 16 29 78 56 62 75 48 69 12 89 34 27 15 7 80 14 57 29 6 80 46 64 94 83 96 1 42 11 41 15 26 17 36 44 11 68 73 93 45 73 35 91 14 84 48 7 8 63 84 59 68 87 26 91 10 54 41 74 71 74 62 24\\r\\n', 'output': ['4110\\r\\n']}, {'input': '94 12\\r\\n40 66 66 35 43 23 77 6 55 44 68 90 20 59 11 95 78 13 75 98 30 22 40 29 2 23 82 26 53 48 16 100 97 100 74 96 73 30 35 72 23 38 25 86 7 45 53 20 18 77 68 95 41 45 1 94 42 94 54 9 33 84 53 71 6 68 98 94 35 78 58 34 84 78 28 65 58 11 2 78 96 5 8 36 34 26 76 10 69 49 25 9 77 30\\r\\n', 'output': ['4173\\r\\n']}, {'input': '95 17\\r\\n1 24 17 9 41 5 39 30 6 32 17 30 27 11 13 25 22 23 12 31 19 31 35 43 8 23 39 23 39 41 10 17 25 17 38 39 37 23 37 11 6 15 43 4 15 44 44 42 29 2 14 6 1 6 31 45 26 21 14 18 15 17 23 11 39 12 16 6 11 19 15 31 18 10 33 10 2 8 21 4 26 3 42 45 16 1 11 28 43 24 18 45 25 39 9\\r\\n', 'output': ['1360\\r\\n']}, {'input': '96 9\\r\\n4 5 1 10 2 6 1 9 2 6 3 2 9 4 1 1 3 10 10 4 6 8 6 4 4 6 4 6 2 9 1 9 3 6 9 10 4 3 7 2 7 4 4 4 6 4 1 7 9 4 9 2 1 7 7 3 4 10 10 5 1 3 10 5 1 9 8 4 10 4 7 2 9 6 9 4 2 3 6 9 8 1 1 2 9 4 10 4 9 7 7 5 1 10 9 10\\r\\n', 'output': ['225\\r\\n']}, {'input': '97 28\\r\\n13 12 30 2 17 29 28 28 26 10 27 27 20 14 8 28 10 5 33 19 17 31 15 4 8 13 21 23 32 3 20 9 33 17 11 13 11 9 19 30 19 25 1 18 1 13 1 20 19 9 17 31 32 26 1 34 7 34 6 22 7 13 29 6 29 3 13 28 3 6 7 29 17 34 28 32 14 33 23 25 23 11 19 19 27 27 3 20 17 13 24 2 8 25 10 31 34\\r\\n', 'output': ['672\\r\\n']}, {'input': '98 14\\r\\n23 3 39 39 6 35 2 35 38 9 11 24 42 35 35 46 23 46 20 36 25 46 23 9 21 24 21 38 43 9 9 38 38 46 3 28 17 31 30 14 29 12 37 15 5 45 46 32 35 39 39 27 25 15 42 40 19 19 11 6 32 16 25 29 46 2 45 44 5 36 21 11 14 18 39 1 39 26 18 14 1 23 38 24 10 38 14 42 15 3 8 8 23 46 40 19 14 29\\r\\n', 'output': ['1876\\r\\n']}, {'input': '99 57\\r\\n69 27 70 70 16 66 64 35 44 1 51 38 69 17 19 35 83 7 47 4 10 22 60 64 64 56 80 54 83 34 51 42 46 51 41 75 54 10 13 44 66 46 27 79 55 13 13 40 18 12 2 33 20 13 75 45 70 75 51 39 80 25 22 27 77 52 41 83 40 33 23 76 81 21 23 59 27 74 45 68 42 20 83 50 66 58 5 8 55 62 76 81 27 52 55 67 28 65 71\\r\\n', 'output': ['2030\\r\\n']}, {'input': '100 2\\r\\n2 2 1 1 1 1 1 1 1 2 2 1 1 2 2 1 1 2 1 1 1 1 1 1 2 2 2 1 1 2 1 2 1 2 2 1 1 1 1 2 1 1 1 2 2 1 1 2 1 1 2 2 2 2 2 1 2 1 2 1 1 2 1 2 2 2 2 1 2 1 2 1 2 1 2 2 2 1 1 2 2 1 2 1 1 1 1 2 1 2 2 2 1 2 1 1 1 2 2 1\\r\\n', 'output': ['92\\r\\n']}, {'input': '100 2\\r\\n79 84 2 24 18 95 57 79 67 60 78 85 75 23 68 68 76 30 39 31 32 81 42 90 50 33 49 9 63 18 74 46 34 55 48 41 7 75 74 90 14 90 2 49 20 29 33 65 43 7 11 12 58 45 17 100 1 28 3 12 26 94 45 5 45 19 3 28 95 11 71 68 89 47 59 5 74 92 43 100 15 63 78 85 70 38 62 100 78 76 29 69 64 2 32 68 48 61 82 100\\r\\n', 'output': ['4978\\r\\n']}, {'input': '100 17\\r\\n20 61 7 74 87 84 87 35 64 7 36 5 72 20 62 29 29 58 67 51 50 45 82 20 76 79 39 21 5 39 94 13 65 11 3 21 26 2 15 56 20 75 49 27 64 48 51 96 32 80 57 10 57 48 36 83 51 25 45 65 24 22 3 92 45 52 52 58 15 90 23 43 56 88 46 50 72 70 60 47 91 68 40 24 16 44 82 90 17 17 51 71 25 94 13 42 26 25 53 95\\r\\n', 'output': ['3961\\r\\n']}]","id":206} {"description":"Petya has noticed that when he types using a keyboard, he often presses extra buttons and adds extra letters to the words. Of course, the spell-checking system underlines the words for him and he has to click every word and choose the right variant. Petya got fed up with correcting his mistakes himself, that\u2019s why he decided to invent the function that will correct the words itself. Petya started from analyzing the case that happens to him most of the time, when all one needs is to delete one letter for the word to match a word from the dictionary. Thus, Petya faces one mini-task: he has a printed word and a word from the dictionary, and he should delete one letter from the first word to get the second one. And now the very non-trivial question that Petya faces is: which letter should he delete?","input_specification":"The input data contains two strings, consisting of lower-case Latin letters. The length of each string is from 1 to 106 symbols inclusive, the first string contains exactly 1 symbol more than the second one.","output_specification":"In the first line output the number of positions of the symbols in the first string, after the deleting of which the first string becomes identical to the second one. In the second line output space-separated positions of these symbols in increasing order. The positions are numbered starting from 1. If it is impossible to make the first string identical to the second string by deleting one symbol, output one number 0.","notes":null,"sample_inputs":["abdrakadabra\nabrakadabra","aa\na","competition\ncodeforces"],"sample_outputs":["1\n3","2\n1 2","0"],"src_uid":"0df064fd0288c2ac4832efa227107a0e","lang_cluster":"C","difficulty":1500,"human_solution":"#include \n#include \n\nint main()\n{\n char s1[1000001], s2[1000001];\n int n, p = 0, q, i;\n\n scanf(\"%s %s\", s1, s2);\n\n n = strlen(s2);\n\n for (i = 0; i < n; i++) {\n\t if (s1[i] != s1[p]) p = i;\n\n\t if (s1[i] != s2[i]) break;\n }\n\n q = i;\n\n if (i == n) {\n\t if (s1[p] != s1[i]) p = i;\n }\n\n for (; i < n; i++) {\n\t if (s1[i + 1] != s2[i]) break;\n }\n\n if (i < n) {\n\t puts(\"0\");\n } else {\n\t printf(\"%d\\n\", q - p + 1);\n\n\t for (i = p; i <= q; i++) {\n\t if (i > p) putchar(' ');\n\t printf(\"%d\", i + 1);\n\t }\n\n\t puts(\"\");\n }\n\n return 0;\n}\n","testcases":"[{'input': 'abdrakadabra\\r\\nabrakadabra\\r\\n', 'output': ['1\\r\\n3 ']}, {'input': 'aa\\r\\na\\r\\n', 'output': ['2\\r\\n1 2 ']}, {'input': 'competition\\r\\ncodeforces\\r\\n', 'output': ['0\\r\\n']}, {'input': 'ab\\r\\na\\r\\n', 'output': ['1\\r\\n2 ']}, {'input': 'bb\\r\\nb\\r\\n', 'output': ['2\\r\\n1 2 ']}, {'input': 'aab\\r\\nab\\r\\n', 'output': ['2\\r\\n1 2 ']}, {'input': 'aabb\\r\\nabb\\r\\n', 'output': ['2\\r\\n1 2 ']}, {'input': 'babaacaacaa\\r\\nbbaacaacaa\\r\\n', 'output': ['1\\r\\n2 ']}, {'input': 'bccaabbcccc\\r\\nbccaabcccc\\r\\n', 'output': ['2\\r\\n6 7 ']}, {'input': 'ababcaabaaa\\r\\nabacaabaaa\\r\\n', 'output': ['1\\r\\n4 ']}, {'input': 'cccacaccacb\\r\\ncccacaccac\\r\\n', 'output': ['1\\r\\n11 ']}, {'input': 'aaaaaaaaaaa\\r\\naaaaaaaaaa\\r\\n', 'output': ['11\\r\\n1 2 3 4 5 6 7 8 9 10 11 ']}, {'input': 'lcaaxcbcjca\\r\\nccaaacccca\\r\\n', 'output': ['0\\r\\n']}, {'input': 'babbbtaamba\\r\\nbabbbaabba\\r\\n', 'output': ['0\\r\\n']}, {'input': 'xdfxmcnzpch\\r\\nazvotghvtk\\r\\n', 'output': ['0\\r\\n']}, {'input': 'ki\\r\\nb\\r\\n', 'output': ['0\\r\\n']}, {'input': 'vct\\r\\nie\\r\\n', 'output': ['0\\r\\n']}, {'input': 'feee\\r\\nsnl\\r\\n', 'output': ['0\\r\\n']}, {'input': 'cbxxxxzvks\\r\\ncbxxxzvks\\r\\n', 'output': ['4\\r\\n3 4 5 6 ']}, {'input': 'qybldcgfhdhhhhhhhhhhopqkhuczzytzluiahwbqjltgafvvoecititchjwdoljiehubngmtjckqymldhoncgtqhxnqvoagnrmur\\r\\nqybldcgfhdhhhhhhhhhopqkhuczzytzluiahwbqjltgafvvoecititchjwdoljiehubngmtjckqymldhoncgtqhxnqvoagnrmur\\r\\n', 'output': ['10\\r\\n11 12 13 14 15 16 17 18 19 20 ']}]","id":207} {"description":"Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading \u2014 he just leaves some blank space to mark them. Help him; find out if he will manage to compose the needed text.","input_specification":"The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 \u0438 s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of the heading.","output_specification":"If Vasya can write the given anonymous letter, print YES, otherwise print NO","notes":null,"sample_inputs":["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog","Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears","Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears","abcdefg hijk\nk j i h g f e d c b a"],"sample_outputs":["NO","YES","NO","YES"],"src_uid":"b1ef19d7027dc82d76859d64a6f43439","lang_cluster":"C","difficulty":1100,"human_solution":"#include \n\nint main()\n{\n int c[128]={0};\n char a[210];\n char a2[210];\n gets(a);\n gets(a2);\n \n \/\/ printf(\"%d\",c[100]);\n for(int i=0;a[i]!='\\0';i++)\n { \/\/ printf(\"%c %d \",a[i],c[a[i]]); \n c[a[i]]++;}\n int x=0;\n for(int i=0;a2[i]!='\\0';i++)\n { \/\/ printf(\"%c\",a2[i]);\n \n \/\/ printf(\"%c %d \\n \",a2[i],c[a2[i]]); \n x=a2[i];\n if(x!=32&&x!=13)\n {if(c[x])\n c[x]--;\n else\n { x=-1;\n break;} }\n }\n if(x+1)\n printf(\"YES\");\n \n else\n printf(\"NO\");\n \n return 0;\n \n}\n","testcases":"[{'input': 'Instead of dogging Your footsteps it disappears but you dont notice anything\\r\\nwhere is your dog\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'Instead of dogging Your footsteps it disappears but you dont notice anything\\r\\nYour dog is upstears\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'Instead of dogging your footsteps it disappears but you dont notice anything\\r\\nYour dog is upstears\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'abcdefg hijk\\r\\nk j i h g f e d c b a\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'HpOKgo\\r\\neAtAVB\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'GRZGc\\r\\nLPzD\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'GtPXu\\r\\nd\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'FVF\\r\\nr \\r\\n', 'output': ['NO\\r\\n']}, {'input': 'HpOKgo\\r\\nogK\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'GRZGc\\r\\nZG\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'HpOKgoueAtAVBdGffvQheJDejNDHhhwyKJisugiRAH OseK yUwqPPNuThUxTfthqIUeb wS jChGOdFDarNrKRT MlwKecxWNoKEeD BbiHAruE XMlvKYVsJGPP\\r\\nAHN XvoaNwV AVBKwKjr u U K wKE D K Jy KiHsR h d W Js IHyMPK Br iSqe E fDA g H\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'GRZGcsLPzDrCSXhhNTaibJqVphhjbcPoZhCDUlzAbDnRWjHvxLKtpGiFWiGbfeDxBwCrdJmJGCGv GebAOinUsFrlqKTILOmxrFjSpEoVGoTdSSstJWVgMLKMPettxHASaQZNdOIObcTxtF qTHWBdNIKwj\\r\\nWqrxze Ji x q aT GllLrRV jMpGiMDTwwS JDsPGpAZKACmsFCOS CD Sj bCDgKF jJxa RddtLFAi VGLHH SecObzG q hPF \\r\\n', 'output': ['YES\\r\\n']}, {'input': 'GtPXuwdAxNhODQbjRslDDKciOALJrCifTjDQurQEBeFUUSZWwCZQPdYwZkYbrduMijFjgodAOrKIuUKwSXageZuOWMIhAMexyLRzFuzuXqBDTEaWMzVdbzhxDGSJC SsIYuYILwpiwwcObEHWpFvHeBkWYNitqYrxqgHReHcKnHbtjcWZuaxPBVPb\\r\\nTQIKyqFaewOkY lZUOOuxEw EwuKcArxRQGFYkvVWIAe SuanPeHuDjquurJu aSxwgOSw jYMwjxItNUUArQjO BIujAhSwttLWp\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'FVFSr unvtXbpKWF vPaAgNaoTqklzVqiGYcUcBIcattzBrRuNSnKUtmdGKbjcE\\r\\nUzrU K an GFGR Wc zt iBa P c T K v p V In b B c\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'lSwjnYLYtDNIZjxHiTawdh ntSzggZogcIZTuiTMWVgwyloMtEhqkrOxgIcFvwvsboXUPILPIymFAEXnhApewJXJNtFyZ\\r\\nAoxe jWZ u yImg o AZ FNI w lpj tNhT g y ZYcb rc J w Dlv\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'kvlekcdJqODUKdsJlXkRaileTmdGwUHWWgvgUokQxRzzbpFnswvNKiDnjfOFGvFcnaaiRnBGQmqoPxDHepgYasLhzjDgmvaFfVNEcSPVQCJKAbSyTGpXsAjIHr\\r\\nGjzUllNaGGKXUdYmDFpqFAKIwvTpjmqnyswWRTnxlBnavAGvavxJemrjvRJc\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'kWbvhgvvoYOhwXmgTwOSCDXrtFHhqwvMlCvsuuAUXMmWaYXiqHplFZZemhgkTuvsUtIaUxtyYauBIpjdbyYxjZ ZkaBPzwqPfqF kCqGRmXvWuabnQognnkvdNDtRUsSUvSzgBuxCMBWJifbxWegsknp\\r\\nBsH bWHJD n Ca T xq PRCv tatn Wjy sm I q s WCjFqdWe t W XUs Do eb Pfh ii hTbF O Fll\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'OTmLdkMhmDEOMQMiW ZpzEIjyElHFrNCfFQDp SZyoZaEIUIpyCHfwOUqiSkKtFHggrTBGkqfOxkChPztmPrsHoxVwAdrxbZLKxPXHlMnrkgMgiaHFopiFFiUEtKwCjpJtwdwkbJCgA bxeDIscFdmHQJLAMNhWlrZisQrHQpvbALWTwpf jnx\\r\\nDbZwrQbydCdkJMCrftiwtPFfpMiwwrfIrKidEChKECxQUBVUEfFirbGWiLkFQkdJiFtkrtkbIAEXCEDkwLpK\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'NwcGaIeSkOva\\r\\naIa\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'gSrAcVYgAdbdayzbKGhIzLDjyznLRIJH KyvilAaEddmgkBPCNzpmPNeGEbmmpAyHvUSoPvnaORrPUuafpReEGoDOQsAYnUHYfBqhdcopQfxJuGXgKnbdVMQNhJYkyjiJDKlShqBTtnnDQQzEijOMcYRGMgPGVhfIReYennKBLwDTVvcHMIHMgVpJkvzTrezxqS\\r\\nHJerIVvRyfrPgAQMTI AqGNO mQDfDwQHKgeeYmuRmozKHILvehMPOJNMRtPTAfvKvsoGKi xHEeKqDAYmQJPUXRJbIbHrgVOMGMTdvYiLui\\r\\n', 'output': ['YES\\r\\n']}, {'input': 'ReB hksbHqQXxUgpvoNK bFqmNVCEiOyKdKcAJQRkpeohpfuqZabvrLfmpZOMcfyFBJGZwVMxiUPP pbZZtJjxhEwvrAba\\r\\nJTCpQnIViIGIdQtLnmkVzmcbBZR CoxAdTtWSYpbOglDFifqIVQ vfGKGtLpxpJHiHSWCMeRcrVOXBGBhoEnVhNTPWGTOErNtSvokcGdgZXbgTEtISUyTwaXUEIlJMmutsdCbiyrPZPJyRdOjnSuAGttLy\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'hrLzRegCuDGxTrhDgVvM KowwyYuXGzIpcXdSMgeQVfVOtJZdkhNYSegwFWWoPqcZoeapbQnyCtojgkcyezUNHGGIZrhzsKrvvcrtokIdcnqXXkCNKjrOjrnEAKBNxyDdiMVeyLvXxUYMZQRFdlcdlcxzKTeYzBlmpNiwWbNAAhWkMoGpRxkCuyqkzXdKWwGH\\r\\nJESKDOfnFdxPvUOCkrgSBEPQHJtJHzuNGstRbTCcchRWJvCcveSEAtwtOmZZiW\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'yDBxCtUygQwWqONxQCcuAvVCkMGlqgC zvkfEkwqbhMCQxnkwQIUhucCbVUyOBUcXvTNEGriTBwMDMfdsPZgWRgIUDqM\\r\\neptVnORTTyixxmWIBpSTEwOXqGZllBgSxPenYCDlFwckJlWsoVwWLAIbPOmFqcKcTcoQqahetl KLfVSyaLVebzsGwPSVbtQAeUdZAaJtfxlCEvvaRhLlVvRJhKat IaB awdqcDlrrhTbRxjEbzGwcdmdavkhcjHjzmwbxAgw\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'jlMwnnotSdlQMluKWkJwAeCetcqbIEnKeNyLWoKCGONDRBQOjbkGpUvDlmSFUJ bWhohqmmIUWTlDsvelUArAcZJBipMDwUvRfBsYzMdQnPDPAuBaeJmAxVKwUMJrwMDxNtlrtAowVWqWiwFGtmquZAcrpFsLHCrvMSMMlvQUqypAihQWrFMNoaqfs IBg\\r\\nNzeWQ bafrmDsYlpNHSGTBBgPl WIcuNhyNaNOEFvL\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'zyWvXBcUZqGqjHwZHQryBtFliLYnweXAoMKNpLaunaOlzaauWmLtywsEvWPiwxJapocAFRMjrqWJXYqfKEbBKnzLO\\r\\npsbi bsXpSeJaCkIuPWfSRADXdIClxcDCowwJzGCDTyAl\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'kKhuIwRPLCwPFfcnsyCfBdnsraGeOCcLTfXuGjqFSGPSAeDZJSS bXKFanNqWjpFnvRpWxHJspvisDlADJBioxXNbVoXeUedoPcNEpUyEeYxdJXhGzFAmpAiHotSVwbZQsuWjIVhVaEGgqbZHIoDpiEmjTtFylCwCkWWzUOoUfOHxEZvDwNpXhBWamHn\\r\\nK VpJjGhNbwCRhcfmNGVjewBFpEmPlIKeTuWiukDtEWpjgqciqglkyNfWrBLbGAKvlNWxaUelJmSlSoakSpRzePvJsshOsTYrMPXdxKpaShjyVIXGhRIAdtiGpNwtiRmGTBZhkJqIMdxMHX RMxCMYcWjcjhtCHyFnCvjjezGbkRDRiVxkbh\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'AXssNpFKyQmJcBdBdfkhhMUzfqJVgcLBddkwtnFSzSRUCjiDcdtmkzIGkCKSxWUEGhmHmciktJyGMkgCductyHx\\r\\nI nYhmJfPnvoKUiXYUBIPIcxNYTtvwPUoXERZvY ahlDpQFNMmVZqEBiYqYlHNqcpSCmhFczBlOAhsYFeqMGfqL EJsDNOgwoJfBzqijKOFcYQ\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'lkhrzDZmkdbjzYKPNMRkiwCFoZsMzBQMnxxdKKVJezSBjnLjPpUYtabcPTIaDJeDEobbWHdKOdVfMQwDXzDDcSrwVenDEYpMqfiOQ xSsqApWnAMoyhQXCKFzHvvzvUvkWwmwZrvZz\\r\\nsUzGspYpRFsHRbRgTQuCBgnFgPkisTUfFNwyEEWWRiweWWgjRkVQxgTwxOzdsOwfrGIH O gCXpzvHzfItuEHaihmugEyymSJIogYwX qAwcwIItidfnzZDhZgQHi eRjMAeVkJHceDZuJkmxGowOsmcGYYvk Ajtgi TxwihvjLViNZjvscTWvsaQUelTSivLShhEl\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'BRsVjyNhrqRHVwrJzuzRigEhdpbDmaACSPfed\\r\\nlWqKTjlrqOCUbgBBZdZDGCeQJDXawPnnDkQdZDgwrEQk\\r\\n', 'output': ['NO\\r\\n']}, {'input': 'KRmINuyBYPwiTsdlyiNVuylToysJKmOpcLovAtwGPqrgFJQNAYvuAiyQRkeFMECVZvkDEmTauXlyjAaYRnTJXORMZRnTakBaUzSelMilejySDIZjQjzcOIrwXdvDvpeRIkoBgreyFXIyyIZutjiEBtwrmzQtPVUhvvdEtDMbXjBpoPVjGdM EXTAK JbCnw\\r\\nXZZqlJvzKKtvdNlzFPDTYxidqlsgufVzyEmO FZuLQ vVQsJESNviUCovCK NwwlbxsmPtOJNmAonCqrOZ bZ LVKAsQGmoLnYjeekvEIECFk\\r\\n', 'output': ['NO\\r\\n']}]","id":208} {"description":"A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count. The game goes as follows. Kids stand in circle. Let's agree to think of the children as numbered with numbers from 1 to n clockwise and the child number 1 is holding the ball. First the first child throws the ball to the next one clockwise, i.e. to the child number 2. Then the child number 2 throws the ball to the next but one child, i.e. to the child number 4, then the fourth child throws the ball to the child that stands two children away from him, i.e. to the child number 7, then the ball is thrown to the child who stands 3 children away from the child number 7, then the ball is thrown to the child who stands 4 children away from the last one, and so on. It should be mentioned that when a ball is thrown it may pass the beginning of the circle. For example, if n\u2009=\u20095, then after the third throw the child number 2 has the ball again. Overall, n\u2009-\u20091 throws are made, and the game ends.The problem is that not all the children get the ball during the game. If a child doesn't get the ball, he gets very upset and cries until Natalia Pavlovna gives him a candy. That's why Natalia Pavlovna asks you to help her to identify the numbers of the children who will get the ball after each throw.","input_specification":"The first line contains integer n (2\u2009\u2264\u2009n\u2009\u2264\u2009100) which indicates the number of kids in the circle.","output_specification":"In the single line print n\u2009-\u20091 numbers which are the numbers of children who will get the ball after each throw. Separate the numbers by spaces.","notes":null,"sample_inputs":["10","3"],"sample_outputs":["2 4 7 1 6 2 9 7 6","2 1"],"src_uid":"7170c40405cf7a5e0f2bd15e4c7d189d","lang_cluster":"C","difficulty":800,"human_solution":"#include \n\nint main() {\n int n ,x=1;\n scanf(\"%d\",&n);\n for (int i=1; in)\n {\n x=x-n;\n }\n \n printf(\"%d \",x);\n \n }\n return 0;\n}\n","testcases":"[{'input': '10\\r\\n', 'output': ['2 4 7 1 6 2 9 7 6\\r\\n']}, {'input': '3\\r\\n', 'output': ['2 1\\r\\n']}, {'input': '4\\r\\n', 'output': ['2 4 3\\r\\n']}, {'input': '5\\r\\n', 'output': ['2 4 2 1\\r\\n']}, {'input': '6\\r\\n', 'output': ['2 4 1 5 4\\r\\n']}, {'input': '7\\r\\n', 'output': ['2 4 7 4 2 1\\r\\n']}, {'input': '8\\r\\n', 'output': ['2 4 7 3 8 6 5\\r\\n']}, {'input': '9\\r\\n', 'output': ['2 4 7 2 7 4 2 1\\r\\n']}, {'input': '2\\r\\n', 'output': ['2\\r\\n']}, {'input': '11\\r\\n', 'output': ['2 4 7 11 5 11 7 4 2 1\\r\\n']}, {'input': '12\\r\\n', 'output': ['2 4 7 11 4 10 5 1 10 8 7\\r\\n']}, {'input': '13\\r\\n', 'output': ['2 4 7 11 3 9 3 11 7 4 2 1\\r\\n']}, {'input': '20\\r\\n', 'output': ['2 4 7 11 16 2 9 17 6 16 7 19 12 6 1 17 14 12 11\\r\\n']}, {'input': '25\\r\\n', 'output': ['2 4 7 11 16 22 4 12 21 6 17 4 17 6 21 12 4 22 16 11 7 4 2 1\\r\\n']}, {'input': '30\\r\\n', 'output': ['2 4 7 11 16 22 29 7 16 26 7 19 2 16 1 17 4 22 11 1 22 14 7 1 26 22 19 17 16\\r\\n']}, {'input': '35\\r\\n', 'output': ['2 4 7 11 16 22 29 2 11 21 32 9 22 1 16 32 14 32 16 1 22 9 32 21 11 2 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '40\\r\\n', 'output': ['2 4 7 11 16 22 29 37 6 16 27 39 12 26 1 17 34 12 31 11 32 14 37 21 6 32 19 7 36 26 17 9 2 36 31 27 24 22 21\\r\\n']}, {'input': '45\\r\\n', 'output': ['2 4 7 11 16 22 29 37 1 11 22 34 2 16 31 2 19 37 11 31 7 29 7 31 11 37 19 2 31 16 2 34 22 11 1 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '50\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 6 17 29 42 6 21 37 4 22 41 11 32 4 27 1 26 2 29 7 36 16 47 29 12 46 31 17 4 42 31 21 12 4 47 41 36 32 29 27 26\\r\\n']}, {'input': '55\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 1 12 24 37 51 11 27 44 7 26 46 12 34 2 26 51 22 49 22 51 26 2 34 12 46 26 7 44 27 11 51 37 24 12 1 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '60\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 7 19 32 46 1 17 34 52 11 31 52 14 37 1 26 52 19 47 16 46 17 49 22 56 31 7 44 22 1 41 22 4 47 31 16 2 49 37 26 16 7 59 52 46 41 37 34 32 31\\r\\n']}, {'input': '65\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 2 14 27 41 56 7 24 42 61 16 37 59 17 41 1 27 54 17 46 11 42 9 42 11 46 17 54 27 1 41 17 59 37 16 61 42 24 7 56 41 27 14 2 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '70\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 9 22 36 51 67 14 32 51 1 22 44 67 21 46 2 29 57 16 46 7 39 2 36 1 37 4 42 11 51 22 64 37 11 56 32 9 57 36 16 67 49 32 16 1 57 44 32 21 11 2 64 57 51 46 42 39 37 36\\r\\n']}, {'input': '75\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 4 17 31 46 62 4 22 41 61 7 29 52 1 26 52 4 32 61 16 47 4 37 71 31 67 29 67 31 71 37 4 47 16 61 32 4 52 26 1 52 29 7 61 41 22 4 62 46 31 17 4 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '80\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 12 26 41 57 74 12 31 51 72 14 37 61 6 32 59 7 36 66 17 49 2 36 71 27 64 22 61 21 62 24 67 31 76 42 9 57 26 76 47 19 72 46 21 77 54 32 11 71 52 34 17 1 66 52 39 27 16 6 77 69 62 56 51 47 44 42 41\\r\\n']}, {'input': '85\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 7 21 36 52 69 2 21 41 62 84 22 46 71 12 39 67 11 41 72 19 52 1 36 72 24 62 16 56 12 54 12 56 16 62 24 72 36 1 52 19 72 41 11 67 39 12 71 46 22 84 62 41 21 2 69 52 36 21 7 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '90\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 2 16 31 47 64 82 11 31 52 74 7 31 56 82 19 47 76 16 47 79 22 56 1 37 74 22 61 11 52 4 47 1 46 2 49 7 56 16 67 29 82 46 11 67 34 2 61 31 2 64 37 11 76 52 29 7 76 56 37 19 2 76 61 47 34 22 11 1 82 74 67 61 56 52 49 47 46\\r\\n']}, {'input': '95\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 11 26 42 59 77 1 21 42 64 87 16 41 67 94 27 56 86 22 54 87 26 61 2 39 77 21 61 7 49 92 41 86 37 84 37 86 41 92 49 7 61 21 77 39 2 61 26 87 54 22 86 56 27 94 67 41 16 87 64 42 21 1 77 59 42 26 11 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '96\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 10 25 41 58 76 95 19 40 62 85 13 38 64 91 23 52 82 17 49 82 20 55 91 32 70 13 53 94 40 83 31 76 26 73 25 74 28 79 35 88 46 5 61 22 80 43 7 68 34 1 65 34 4 71 43 16 86 61 37 14 88 67 47 28 10 89 73 58 44 31 19 8 94 85 77 70 64 59 55 52 50 49\\r\\n']}, {'input': '97\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 9 24 40 57 75 94 17 38 60 83 10 35 61 88 19 48 78 12 44 77 14 49 85 25 63 5 45 86 31 74 21 66 15 62 13 62 15 66 21 74 31 86 45 5 63 25 85 49 14 77 44 12 78 48 19 88 61 35 10 83 60 38 17 94 75 57 40 24 9 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '98\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 8 23 39 56 74 93 15 36 58 81 7 32 58 85 15 44 74 7 39 72 8 43 79 18 56 95 37 78 22 65 11 56 4 51 1 50 2 53 7 60 16 71 29 86 46 7 67 30 92 57 23 88 56 25 93 64 36 9 81 56 32 9 85 64 44 25 7 88 72 57 43 30 18 7 95 86 78 71 65 60 56 53 51 50\\r\\n']}, {'input': '99\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 7 22 38 55 73 92 13 34 56 79 4 29 55 82 11 40 70 2 34 67 2 37 73 11 49 88 29 70 13 56 1 46 92 40 88 38 88 40 92 46 1 56 13 70 29 88 49 11 73 37 2 67 34 2 70 40 11 82 55 29 4 79 56 34 13 92 73 55 38 22 7 92 79 67 56 46 37 29 22 16 11 7 4 2 1\\r\\n']}, {'input': '100\\r\\n', 'output': ['2 4 7 11 16 22 29 37 46 56 67 79 92 6 21 37 54 72 91 11 32 54 77 1 26 52 79 7 36 66 97 29 62 96 31 67 4 42 81 21 62 4 47 91 36 82 29 77 26 76 27 79 32 86 41 97 54 12 71 31 92 54 17 81 46 12 79 47 16 86 57 29 2 76 51 27 4 82 61 41 22 4 87 71 56 42 29 17 6 96 87 79 72 66 61 57 54 52 51\\r\\n']}]","id":209} {"description":"Wilbur the pig now wants to play with strings. He has found an n by m table consisting only of the digits from 0 to 9 where the rows are numbered 1 to n and the columns are numbered 1 to m. Wilbur starts at some square and makes certain moves. If he is at square (x, y) and the digit d (0\u2264d\u22649) is written at position (x, y), then he must move to the square (x+ad, y+bd), if that square lies within the table, and he stays in the square (x, y) otherwise. Before Wilbur makes a move, he can choose whether or not to write the digit written in this square on the white board. All digits written on the whiteboard form some string. Every time a new digit is written, it goes to the end of the current string.Wilbur has q strings that he is worried about. For each string si, Wilbur wants to know whether there exists a starting position (x, y) so that by making finitely many moves, Wilbur can end up with the string si written on the white board.","input_specification":"The first line of the input consists of three integers n, m, and q (1\u2264n,m,q\u2264200)\u00a0\u2014 the dimensions of the table and the number of strings to process, respectively.\nEach of the next n lines contains m digits from 0 and 9 giving the table itself.\nThen follow 10 lines. The i-th of them contains the values ai-1 and bi-1 (-200\u2264ai,bi\u2264200), i.e. the vector that Wilbur uses to make a move from the square with a digit i-1 in it.\nThere are q lines that follow. The i-th of them will contain a string si consisting only of digits from 0 to 9. It is guaranteed that the total length of these q strings won't exceed 1000000.\n","output_specification":"For each of the q strings, print \"YES\" if Wilbur can choose x and y in order to finish with this string after some finite number of moves. If it's impossible, than print \"NO\" for the corresponding string.\n","notes":"In the first sample, there is a 1 by 1 table consisting of the only digit 0. The only move that can be made is staying on the square. The first string can be written on the white board by writing 0 repeatedly. The second string cannot be written as there is no 2 on the table.\n","sample_inputs":["1 1 2\n0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0000000000000\n2413423432432\n","4 2 5\n01\n23\n45\n67\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0000000000\n010101011101\n32232232322\n44343222342444324\n6767\n"],"sample_outputs":["YES\nNO\n","YES\nYES\nYES\nNO\nYES\n"],"src_uid":"596_E","lang_cluster":"C","difficulty":2500,"human_solution":"#include\r\n#include\r\nint n,m,q,ip1[200][200],procinfo[40000][10],status[200][200],ip2[10][2],glob[10],nm;\r\nchar ch[201],inch[1000001];\r\n\r\nvoid fill_glob(int si,int sj,int ei,int ej){\r\n\r\nint i,dx,dy;\r\nfor(i=0;i<10;i++)\r\n glob[i]=-1;\r\n\r\nwhile(!(si==ei && sj == ej)){\r\nif(glob[ip1[si][sj]]==-1)\r\n glob[ip1[si][sj]]=si*m+sj;\r\n\r\n\r\ndx=ip2[ip1[si][sj]][0];\r\ndy=ip2[ip1[si][sj]][1];\r\n\r\nsi=si+dx;\r\nsj=sj+dy;\r\n\r\n}\r\n\r\nif(glob[ip1[si][sj]]==-1)\r\n glob[ip1[si][sj]]=si*m+sj;\r\n\r\n\/\/test\r\n\/*printf(\"%d %d %d %d\\n\",si,sj,ei,ej);\r\nfor(i=0;i<10;i++)\r\n printf(\"%d \",glob[i]);\r\nprintf(\"\\n\");*\/\r\n\r\n}\r\n\r\nvoid process_indx(int i,int j){\r\n\r\nstatus[i][j]=-2;\r\nint ni,nj,dx,dy,eq,l,neq;\r\neq=i*m+j;\r\ndx=ip2[ip1[i][j]][0];\r\ndy=ip2[ip1[i][j]][1];\r\nni=i+dx;\r\nnj=j+dy;\r\nneq=ni*m+nj;\r\n\r\nif(ni<0 || ni>n-1 || nj <0 || nj >m-1){\r\nfor(l=0;l<10;l++)\r\n procinfo[eq][l]=-1;\r\n procinfo[eq][ip1[i][j]]=eq;\r\nstatus[i][j]=0;\r\nreturn;\r\n}\r\n\r\nif(status[ni][nj]==-2){\r\n\r\nfill_glob(ni,nj,i,j);\r\nfor(l=0;l<10;l++)\r\n procinfo[eq][l]=glob[l];\r\nstatus[i][j]=0;\r\nreturn;\r\n}\r\n\r\nif(status[ni][nj]==-1){\r\n\r\n process_indx(ni,nj);\r\n\r\n}\r\n\r\n\r\n for(l=0;l<10;l++)\r\n procinfo[eq][l]=procinfo[neq][l];\r\n procinfo[eq][ip1[ni][nj]]=neq;\r\n status[i][j]=0;\r\n return;\r\n\r\n\r\n\r\n\r\n}\r\n\r\nvoid read_input(){\r\nint i,j;\r\nscanf(\"%d %d %d\",&n,&m,&q);\r\nfor(i=0;i=k)\r\n break;\r\n status[x][y]=k;\r\n }\r\n\r\n if(k==len)\r\n break;\r\n\r\n}\r\n\r\nif(j